Search notes:
Shell command: column
column
creates visually appealing tables. By default, every line is interpreted as a cell for the table.
The -c
option determines the width of the created table (c stands for console columns, not for table columns).
Here's an example with the following simple file:
one
two
three
four
five
six
seven
eight
nine
ten
eleven
twelve
thirteen
fourteen
fivteen
sixteen
seventeen
eighteen
nineteen
twenty
The following command
column -c 40 testfiles/numbers.txt
turns the file into
one eleven
two twelve
three thirteen
four fourteen
five fivteen
six sixteen
seven seventeen
eight eighteen
nine nineteen
ten twenty
With -c 60
, I can specify the output to be wider:
column -c 40 testfiles/numbers.txt
one eight fivteen
two nine sixteen
three ten seventeen
four eleven eighteen
five twelve nineteen
six thirteen twenty
seven fourteen
Unfortunately, the output is separated by tabs, not by whitespaces!
See also
cut to cut specific columns.