Column Cheat Sheet
Aus MattWiki
column
command allows for output of given data in columns.
General
Run on specified file and output in columns
column /etc/group
Run from standard output and output in columns
cat /etc/group | column -x
-x
sort contents row by row (horizontally first) instead of column by column (vertically first), which is default behaviour
Table Mode
cat /etc/passwd | column -t -s ":" -N USERNAME,PW,UID,GUID,COMMENT,HOME,INTERPRETER -H PW -O USERNAME,COMMENT,HOME,INTERPRETER,UID
-t
for table mode
-s
separate columns by character
-N
specify columns names
-H
hide specified column
-O
specify oder of columns
JSON Mode
Output table in JSON format:
cat /etc/passwd | column -t -s ":" -N USERNAME,PW,UID,GUID,COMMENT,HOME,INTERPRETER -H PW -O USERNAME,COMMENT,HOME,INTERPRETER,UID -J -n passwordfile
-J
output in JSON format
-n
name of output