Unix Command (Mac OS): cut and move rows
Using a perl one-liner
perl -lne 'push @{$l[($.-1) % 3]}, $_; }{ print "@$_" for @l' data.txt | column -t
Explanation:
Switches:
-l
: Enable line ending processing, specifies line terminator-n
: Creates awhile(<>){..}
loop for each line in your input file.-e
: Tellsperl
to execute the code on command line.
Code:
push @{$l[($.-1) % 3]}, $_;
: Push each line into an array modulo the line number}{ print "@$_" for @l
: Print the 3 element array at end of processing| column -t
: Even out the columns