The paper addresses the problem of row straightening of agents via local interactions. A nonlinear control protocol that ensures finite-time equidistant allocation on a segment is proposed. With the designed protocol, any settling time can be guaranteed regardless of the initial conditions. A robust modification of the control algorithm based on sliding mode control technique is presented. The case of multidimensional agents is also considered. The theoretical results are illustrated via numerical simulations.