Column Cheat Sheet: Unterschied zwischen den Versionen

Aus MattWiki
Die Seite wurde neu angelegt: „<code>column</code> command cheat sheet Kategorie:Linux Kategorie:Terminal
 
Keine Bearbeitungszusammenfassung
Zeile 1: Zeile 1:
<code>column</code> command cheat sheet
<code>column</code> 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
<code>-x</code> 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
<code>-t</code> for table mode
<code>-s</code> separate columns by character
<code>-N</code> specify columns names
<code>-H</code> hide specified column
<code>-O</code> 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
<code>-J</code> output in JSON format
<code>-n</code> name of output
[[Kategorie:Linux]]
[[Kategorie:Linux]]
[[Kategorie:Terminal]]
[[Kategorie:Terminal]]

Version vom 1. Juni 2025, 09:41 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

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