I have this file:
line1
line2
line3
line4
line5
line6
line7
line8
line9
And I want to print it across 3 columns with this structure so that first column has lines 1-2-3
, second column has the lines 4-5
and the last column has the lines 6-7-8-9
(or the rest of the file):
line1 line4 line6
line2 line5 line7
line3 line8
line9
Essentially I want to print a file in a way that the output is distributed to N columns and every column has predetermined (and possibly different from each other) amount of lines. If possible, I want to preserve leading/trailing spaces in lines. How can I do that?
I fiddled around with columns
and pr
, but I couldn't even come close.
pr -m <(sed -n 1,3p file) <(sed -n 4,5p file) <(sed -n 6,9p file)
– pLumo Oct 5 '18 at 12:47