Column Cheat Sheet: Unterschied zwischen den Versionen
Aus MattWiki
Matt (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
Matt (Diskussion | Beiträge) |
||
Zeile 9: | Zeile 9: | ||
== Table Mode == | == 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 | cat /etc/passwd | column -t -s ":" -N USERNAME,PW,UID,GUID,COMMENT,HOME,INTERPRETER -H PW -O USERNAME,COMMENT,HOME,INTERPRETER,UID | ||
<code>-t</code> for table mode | <code>-t</code> for table mode |
Aktuelle Version vom 1. Juni 2025, 09:42 Uhr
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