]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - text-utils/column.1
Manual pages: order NOTES / HISTORY / BUGS / EXAMPLE consistently
[thirdparty/util-linux.git] / text-utils / column.1
index 2e7bad9e9d0bdb5e745d8d2f2fbc14c3284d525e..e43d6fee406ec63ad969d304eba0963d0cafe2b7 100644 (file)
@@ -31,7 +31,7 @@
 .\"
 .\"     @(#)column.1   8.1 (Berkeley) 6/6/93
 .\"
-.TH COLUMN 1 "July 2014" "util-linux" "User Commands"
+.TH COLUMN 1 "February 2019" "util-linux" "User Commands"
 .SH NAME
 column \- columnate lists
 .SH SYNOPSIS
@@ -40,13 +40,36 @@ column \- columnate lists
 .SH DESCRIPTION
 The
 .B column
-utility formats its input into multiple columns.  By default, rows
-are filled before columns.  Input is taken from \fIfile\fR, or
-otherwise from standard input.  Empty lines are ignored.
+utility formats its input into multiple columns.  The util support three modes:
+.TP
+.B columns are filled before rows
+This is the default mode (required by backward compatibility).
+.TP
+.B rows are filled before columns
+This mode is enabled by option \fB\-x, \-\-fillrows\fP
+.TP
+.B table
+Determine the number of columns the input contains and create a table.  This
+mode is enabled by option \fB\-t, \-\-table\fP and columns formatting is
+possible to modify by \fB\-\-table-*\fP options.  Use this mode if not sure.
+.PP
+Input is taken from \fIfile\fR, or otherwise from standard input.  Empty lines
+are ignored and all invalid multibyte sequences are encoded by \\x<hex> convention.
 .PP
 .SH OPTIONS
-.IP "\fB\-c, \-\-columns\fP \fIwidth\fP"
-Output is formatted to a width specified as number of characters.
+The argument \fIcolumns\fP for \fB\-\-table-*\fP options is comma separated
+list of the column names as defined by \fB\-\-table-columns\fP or it's column
+number in order as specified by input. It's possible to mix names and numbers.
+.PP
+.IP "\fB\-J, \-\-json\fP"
+Use JSON output format to print the table, the option
+\fB\-\-table\-columns\fP is required and the option \fB\-\-table\-name\fP is recommended.
+.IP "\fB\-c, \-\-output\-width\fP \fIwidth\fP"
+Output is formatted to a width specified as number of characters. The original
+name of this option is \-\-columns; this name is deprecated since v2.30. Note that input
+longer than \fIwidth\fP is not truncated by default.
+.IP "\fB\-d, \-\-table\-noheadings\fP"
+Do not print header. This option allows to use logical column names on command line, but keep the header hidden when print the table.
 .IP "\fB\-o, \-\-output\-separator\fP \fIstring\fP"
 Specify the columns delimiter for table output (default is two spaces).
 .IP "\fB\-s, \-\-separator\fP \fIseparators\fP"
@@ -56,8 +79,46 @@ Determine the number of columns the input contains and create a table.
 Columns are delimited with whitespace, by default, or with the characters
 supplied using the \fB\-\-output\-separator\fP option.
 Table output is useful for pretty-printing.
+.IP "\fB\-N, \-\-table-columns\fP \fInames\fP"
+Specify the columns names by comma separated list of names. The names are used
+for the table header or to address column in option arguments.
+.IP "\fB\-R, \-\-table-right\fP \fIcolumns\fP"
+Right align text in the specified columns.
+.IP "\fB\-T, \-\-table-truncate\fP \fIcolumns\fP"
+Specify columns where is allowed to truncate text when necessary, otherwise
+very long table entries may be printed on multiple lines.
+.IP "\fB\-E, \-\-table-noextreme\fP \fIcolumns\fP"
+Specify columns where is possible to ignore unusually long (longer than
+average) cells when calculate column width.  The option has impact to the width
+calculation and table formatting, but the printed text is not affected.
+
+The option is used for the last visible column by default.
+
+.IP "\fB\-e, \-\-table\-header\-repeat\fP"
+Print header line for each page.
+.IP "\fB\-W, \-\-table-wrap\fP \fIcolumns\fP"
+Specify columns where is possible to use multi-line cell for long text when
+necessary.
+.IP "\fB\-H, \-\-table-hide\fP \fIcolumns\fP"
+Don't print specified columns. The special placeholder '\-' may be used to
+hide all unnamed columns (see \-\-table-columns).
+.IP "\fB\-O, \-\-table-order\fP \fIcolumns\fP"
+Specify columns order on output.
+.IP "\fB\-n, \-\-table-name\fP \fIname\fP"
+Specify the table name used for JSON output. The default is "table".
+.IP "\fB\-L, \-\-table\-empty\-lines\fP"
+Insert empty line to the table for each empty line on input. The default
+is ignore empty lines at all.
+.IP "\fB\-r, \-\-tree\fP \fIcolumn\fP"
+Specify column to use tree-like output. Note that the circular dependencies and
+another anomalies in child and parent relation are silently ignored.
+.IP "\fB\-i, \-\-tree\-id\fP \fIcolumn\fP"
+Specify column with line ID to create child-parent relation.
+.IP "\fB\-p, \-\-tree\-parent\fP \fIcolumn\fP"
+Specify column with parent ID to create child-parent relation.
+.PP
 .IP "\fB\-x, \-\-fillrows\fP"
-Fill columns before filling rows.
+Fill rows before filling columns.
 .IP "\fB\-V\fR, \fB\-\-version\fR"
 Display version information and exit.
 .IP "\fB\-h, \-\-help\fP"
@@ -65,17 +126,15 @@ Display help text and exit.
 .SH ENVIRONMENT
 The environment variable \fBCOLUMNS\fR is used to determine the size of
 the screen if no other information is available.
-.SH EXAMPLES
-.nf
-.B sed 's/#.*//' /etc/fstab | column -t
-.nf
+.SH HISTORY
+The column command appeared in 4.3BSD-Reno.
 .SH BUGS
 Version 2.23 changed the
 .B \-s
 option to be non-greedy, for example:
 .PP
 .EX
-\fBprintf "a:b:c\\n1::3\\n" | column  -t -s ':'\fR
+\fBprintf "a:b:c\\n1::3\\n" | column \-t \-s ':'\fR
 .EE
 .PP
 Old output:
@@ -89,13 +148,42 @@ New output (since util-linux 2.23):
 a  b  c
 1     3
 .EE
-.SH "SEE ALSO"
+.PP
+Historical versions of this tool indicated that "rows are filled before
+columns" by default, and that the
+.B \-x
+option reverses this. This wording did not reflect the actual behavior, and it
+has since been corrected (see above). Other implementations of
+.B column
+may continue to use the older documentation, but the behavior should be
+identical in any case.
+.SH EXAMPLE
+Print fstab with header line and align number to the right:
+.EX
+\fBsed 's/#.*//' /etc/fstab | column \-\-table \-\-table-columns SOURCE,TARGET,TYPE,OPTIONS,PASS,FREQ \-\-table-right PASS,FREQ\fR
+.EE
+.PP
+Print fstab and hide unnamed columns:
+.EX
+\fBsed 's/#.*//' /etc/fstab | column \-\-table \-\-table-columns SOURCE,TARGET,TYPE \-\-table-hide \-\fR
+.EE
+.PP
+
+.PP
+Print a tree:
+.EX
+\fBecho \-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\fR
+1  0  A
+2  1  |-AA
+4  2  | |-AAA
+5  2  | `-AAB
+3  1  `-AB
+.EE
+.SH SEE ALSO
 .BR colrm (1),
 .BR ls (1),
 .BR paste (1),
 .BR sort (1)
-.SH HISTORY
-The column command appeared in 4.3BSD-Reno.
 .SH AVAILABILITY
 The column command is part of the util-linux package and is available from
-ftp://ftp.kernel.org/pub/linux/utils/util-linux/.
+https://www.kernel.org/pub/linux/utils/util-linux/.