Column Cheat Sheet

Aus MattWiki
Version vom 1. Juni 2025, 09:42 Uhr von Matt (Diskussion | Beiträge) (Table Mode)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)

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

Output columns as table:

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