table of contents
COLUMN(1) | User Commands | COLUMN(1) |
NAME¶
column - columnate lists
SYNOPSIS¶
column [options] [file ...]
DESCRIPTION¶
The column utility formats its input into multiple columns. The util support three modes:
columns are filled before rows
rows are filled before columns
table
Input is taken from file, or otherwise from standard input. Empty lines are ignored and all invalid multibyte sequences are encoded by x<hex> convention.
OPTIONS¶
The argument columns for --table-* options is a comma separated list of the column names as defined by --table-columns or it’s column number in order as specified by input. It’s possible to mix names and numbers. The special placeholder '0' (e.g. -R0) may be used to specify all columns.
-J, --json
-c, --output-width width
-d, --table-noheadings
-o, --output-separator string
-s, --separator separators
-t, --table
-N, --table-columns names
-l, --table-columns-limit number
-R, --table-right columns
-T, --table-truncate columns
-E, --table-noextreme columns
The option is used for the last visible column by default.
-e, --table-header-repeat
-W, --table-wrap columns
-H, --table-hide columns
-O, --table-order columns
-n, --table-name name
-L, --keep-empty-lines
-r, --tree column
-i, --tree-id column
-p, --tree-parent column
-x, --fillrows
-h, --help
-V, --version
ENVIRONMENT¶
The environment variable COLUMNS is used to determine the size of the screen if no other information is available.
HISTORY¶
The column command appeared in 4.3BSD-Reno.
BUGS¶
Version 2.23 changed the -s option to be non-greedy, for example:
printf "a:b:c\n1::3\n" | column -t -s ':'
Old output:
a b c 1 3
New output (since util-linux 2.23):
a b c 1 3
Historical versions of this tool indicated that "rows are filled before columns" by default, and that the -x option reverses this. This wording did not reflect the actual behavior, and it has since been corrected (see above). Other implementations of column may continue to use the older documentation, but the behavior should be identical in any case.
EXAMPLES¶
Print fstab with header line and align number to the right:
sed 's/#.*//' /etc/fstab | column --table --table-columns SOURCE,TARGET,TYPE,OPTIONS,PASS,FREQ --table-right PASS,FREQ
Print fstab and hide unnamed columns:
sed 's/#.*//' /etc/fstab | column --table --table-columns SOURCE,TARGET,TYPE --table-hide -
Print a tree:
echo -e '1 0 A\n2 1 AA\n3 1 AB\n4 2 AAA\n5 2 AAB' | column --tree-id 1 --tree-parent 2 --tree 3 1 0 A 2 1 |-AA 4 2 | |-AAA 5 2 | `-AAB 3 1 `-AB
SEE ALSO¶
REPORTING BUGS¶
For bug reports, use the issue tracker at <https://github.com/util-linux/util-linux/issues>.
AVAILABILITY¶
The column command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>.
2022-08-04 | util-linux 2.38.1 |