column

columnate lists

( a verb. not a noun COLUMNS)

column [-tx ] [-c width] [-s sep] [file]

Formats input to multiple columns by removing sep and inserting spaces or [TAB] 0x09 characters to align columns left justified
Beware of headings or footings.

-t Determine the number of columns (based on -s) the input contains and create a table.
-s sep Set of characters to seperate columns for -t . Default whitespace (?)
-oosep osep is used as output seperator (in some versions!)
Default: Rows are filled down before columns across.
↓1  4  7  
 2  5  8
 3  6  
-x columns aXross → before filling rows down.
 1 →  2   3   
 4    5   6   
 7    8   
-c width width of display (in characters )
Does not RESTRICT output to width, but may increase the number of columns shown!
Default $COLUMNS .
Some terminal emulators change $COLUMNS when screen size is changed.
 > echo $COLUMNS
100
 > column f
↓172.17.55.206   172.17.55.211   172.17.55.216   172.17.55.221   172.17.55.226   172.17.55.231
 172.17.55.207   172.17.55.212   172.17.55.217   172.17.55.222   172.17.55.227   172.17.55.232
 172.17.55.208   172.17.55.213   172.17.55.218   172.17.55.223   172.17.55.228   172.17.55.233
 172.17.55.209   172.17.55.214   172.17.55.219   172.17.55.224   172.17.55.229   172.17.55.234
 172.17.55.210   172.17.55.215   172.17.55.220   172.17.55.225   172.17.55.230
 > column -c128 f
↓172.17.55.206   172.17.55.210   172.17.55.214   172.17.55.218   172.17.55.222   172.17.55.226   172.17.55.230   172.17.55.234
 172.17.55.207   172.17.55.211   172.17.55.215   172.17.55.219   172.17.55.223   172.17.55.227   172.17.55.231
 172.17.55.208   172.17.55.212   172.17.55.216   172.17.55.220   172.17.55.224   172.17.55.228   172.17.55.232
 172.17.55.209   172.17.55.213   172.17.55.217   172.17.55.221   172.17.55.225   172.17.55.229   172.17.55.233

Empty lines and items are ignored.

> cat file
AFPServer:AFPUserAliases:Aliases:AppleMetaRecord:Augments:Automount:AutomountMap:b:Beta:biglonghairyword:tiny

RFPServer:RFPUserAliases:Rliases::Rugments:Rutomount:RutomountMap:b:Beta:biglonghairyword:tiny:fairlysmall:00

> column  -t file
AFPServer  AFPUserAliases  Aliases  AppleMetaRecord  Augments   Automount     AutomountMap  b     Beta              biglonghairyword  tiny
RFPServer  RFPUserAliases  Rliases  Rugments         Rutomount  RutomountMap  b             Beta  biglonghairyword  tiny              fairlysmall  00 

ls -l total 4520 -rw-r--r-- 1 tonylam staff 743 Jun 30 16:48 0 -rw-r--r-- 1 tonylam staff 10378 Oct 30 2020 0finderr -rw-r--r-- 1 tonylam staff 58 Mar 25 18:04 174.127.119.33 -rw-r--r--@ 1 tonylam staff 123883 Aug 7 2020 200704failure.ods drwx--x--x@ 90 tonylam staff 2880 Jun 30 12:44 Documents/ -rwx------@ 1 tonylam staff 22366 May 11 2007 DontUEverCHk.wav* drwx--x--x@ 398 tonylam staff 12736 Jun 29 14:06 Downloads/ drwx--x--x+ 71 tonylam staff 2272 Jun 28 12:01 Library/ lrwxr-xr-x 1 tonylam staff 8 Sep 16 2016 X11@ -> /opt/X11 lrwxr-xr-x 1 tonylam staff 8 Sep 16 2016 X11R6@ -> /opt/X11 Add heading with printf (printf "PERM LINKS OWNER GROUP SIZE MONTH DAY HH:MM/YEAR NAME\n" ; ls -l )|column -t PERM LINKS OWNER GROUP SIZE MONTH DAY HH:MM/YEAR NAME total 4520 -rw-r--r-- 1 tonylam staff 743 Jun 30 16:48 0 -rw-r--r-- 1 tonylam staff 10378 Oct 30 2020 0finderr -rw-r--r-- 1 tonylam staff 58 Mar 25 18:04 174.127.119.33 -rw-r--r--@ 1 tonylam staff 123883 Aug 7 2020 200704failure.ods drwx--x--x@ 90 tonylam staff 2880 Jun 30 12:44 Documents/ -rwx------@ 1 tonylam staff 22366 May 11 2007 DontUEverCHk.wav* drwx--x--x@ 398 tonylam staff 12736 Jun 29 14:06 Downloads/ drwx--x--x+ 71 tonylam staff 2272 Jun 28 12:01 Library/ lrwxr-xr-x 1 tonylam staff 8 Sep 16 2016 X11@ -> /opt/X11 lrwxr-xr-x 1 tonylam staff 8 Sep 16 2016 X11R6@-> /opt/X11

Environment

$COLUMNS defines total width

See also colrm, ls , paste, sort,
stty [-]oxtabs output expands (-not expand) tabs to spaces