]> git.ipfire.org Git - thirdparty/util-linux.git/blob - text-utils/column.1
column: add --table-header-repeat
[thirdparty/util-linux.git] / text-utils / column.1
1 .\" Copyright (c) 1989, 1990, 1993
2 .\" The Regents of the University of California. All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\" @(#)column.1 8.1 (Berkeley) 6/6/93
33 .\"
34 .TH COLUMN 1 "January 2017" "util-linux" "User Commands"
35 .SH NAME
36 column \- columnate lists
37 .SH SYNOPSIS
38 .BR column " [options]"
39 .RI [ file ...]
40 .SH DESCRIPTION
41 The
42 .B column
43 utility formats its input into multiple columns. The util support three modes:
44 .TP
45 .BR "columns are filled before rows"
46 This is the default mode (required by backward compatibility).
47 .TP
48 .BR "rows are filed before columns"
49 This mode is enabled by option \fB-x, \-\-fillrows\fP
50 .TP
51 .BR "table"
52 Determine the number of columns the input contains and create a table. This
53 mode is enabled by option \fB-t, \-\-table\fP and columns formatting is
54 possible to modify by \fB\-\-table-*\fP options. Use this mode if not sure.
55 .PP
56 Input is taken from \fIfile\fR, or otherwise from standard input. Empty lines
57 are ignored.
58 .PP
59 .SH OPTIONS
60 The argument \fIcolumns\fP for \fB\-\-table-*\fP options is comma separated
61 list of the column names as defined by \fB\-\-table-columns\fP or it's column
62 number in order as specified by input. It's possible to mix names and numbers.
63 .PP
64 .IP "\fB\-J, \-\-json\fP"
65 Use JSON output format to print the table, the option
66 \fB\-\-table\-columns\fP is required and the option \fB\-\-table\-name\fP is recommended.
67 .IP "\fB\-c, \-\-output\-width\fP \fIwidth\fP"
68 Output is formatted to a width specified as number of characters. The original
69 name of this option is --columns; this name is deprecated since v2.30. Note that input
70 longer than \fIwidth\fP is not truncated by default.
71 .IP "\fB\-o, \-\-output\-separator\fP \fIstring\fP"
72 Specify the columns delimiter for table output (default is two spaces).
73 .IP "\fB\-s, \-\-separator\fP \fIseparators\fP"
74 Specify the possible input item delimiters (default is whitespace).
75 .IP "\fB\-t, \-\-table\fP"
76 Determine the number of columns the input contains and create a table.
77 Columns are delimited with whitespace, by default, or with the characters
78 supplied using the \fB\-\-output\-separator\fP option.
79 Table output is useful for pretty-printing.
80 .IP "\fB\-N, \-\-table-columns\fP \fInames\fP"
81 Specify the columns names by comma separated list of names. The names are used
82 for the table header or to addres column in option arguments.
83 .IP "\fB\-R, \-\-table-right\fP \fIcolumns\fP"
84 Right align text in the specified columns.
85 .IP "\fB\-T, \-\-table-truncate\fP \fIcolumns\fP"
86 Specify columns where is allowed to truncate text when necessary, otherwise
87 very long table entries may be printed on multiple lines.
88 .IP "\fB\-E, \-\-table-noextreme\fP \fIcolumns\fP"
89 Specify columns where is possible to ignore unusually long (longer than
90 average) cells when calculate column width. The option has impact to the width
91 calculation and table formatting, but the printed text is not affected.
92
93 The option is used for the last visible column by default.
94
95 .IP "\fB\-e, \-\-table\-header\-repeat\fP"
96 Print header line for each page.
97 .IP "\fB\-W, \-\-table-wrap\fP \fIcolumns\fP"
98 Specify columns where is possible to use multi-line cell for long text when
99 necessary.
100 .IP "\fB\-H, \-\-table-hide\fP \fIcolumns\fP"
101 Don't print specified columns.
102 .IP "\fB\-O, \-\-table-order\fP \fIcolumns\fP"
103 Specify columns order on output.
104 .IP "\fB\-n, \-\-table-name\fP \fIname\fP"
105 Specify the table name used for JSON output. The defaout is "table".
106 .IP "\fB\-r, \-\-tree\fP \fIcolumn\fP"
107 Specify column to use tree-like output. Note that the circular dependencies and
108 another anomalies in child and parent relation are silently ignored.
109 .IP "\fB\-i, \-\-tree\-id\fP \fIcolumn\fP"
110 Specify column with line ID to create child-parent relation.
111 .IP "\fB\-p, \-\-tree\-parent\fP \fIcolumn\fP"
112 Specify column with parent ID to create child-parent relation.
113 .PP
114 .IP "\fB\-x, \-\-fillrows\fP"
115 Fill rows before filling columns.
116 .IP "\fB\-V\fR, \fB\-\-version\fR"
117 Display version information and exit.
118 .IP "\fB\-h, \-\-help\fP"
119 Display help text and exit.
120 .SH ENVIRONMENT
121 The environment variable \fBCOLUMNS\fR is used to determine the size of
122 the screen if no other information is available.
123 .SH EXAMPLES
124 Print fstab with header line and align number to the right:
125 .EX
126 \fBsed 's/#.*//' /etc/fstab | column --table --table-columns SOURCE,TARGET,TYPE,OPTIONS,PASS,FREQ --table-right PASS,FREQ\fR
127 .EE
128 .PP
129 Print a tree:
130 .EX
131 \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
132 1 0 A
133 2 1 |-AA
134 4 2 | |-AAA
135 5 2 | `-AAB
136 3 1 `-AB
137 .EE
138 .SH BUGS
139 Version 2.23 changed the
140 .B \-s
141 option to be non-greedy, for example:
142 .PP
143 .EX
144 \fBprintf "a:b:c\\n1::3\\n" | column -t -s ':'\fR
145 .EE
146 .PP
147 Old output:
148 .EX
149 a b c
150 1 3
151 .EE
152 .PP
153 New output (since util-linux 2.23):
154 .EX
155 a b c
156 1 3
157 .EE
158 .SH "SEE ALSO"
159 .BR colrm (1),
160 .BR ls (1),
161 .BR paste (1),
162 .BR sort (1)
163 .SH HISTORY
164 The column command appeared in 4.3BSD-Reno.
165 .SH AVAILABILITY
166 The column command is part of the util-linux package and is available from
167 https://www.kernel.org/pub/linux/utils/util-linux/.