I would like to sort the output of a file into columns because all lines of the output are not the same width and I would like to have the values for each column line up. Any help would be greatly appreciated.
Awk will do it :
Eg a 4 column record line, where field separator is 1 space
awk ' {printf("%Ns %Ns %Ns %Ns",$1,$2,$3,$4) } ' infile > outfile
where N is a decimal value of column width you require.
HTH
Dickie Bird (-)))
Thanks, Dickie Bird!! That works well, however it would be better if I could align the first column to the left. Any chance you could help me out with that?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.