]>
Commit | Line | Data |
---|---|---|
6dbe3af9 KZ |
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 | .\" | |
1ec4c065 | 34 | .TH COLUMN 1 "February 2019" "util-linux" "User Commands" |
6cebde5c | 35 | .SH NAME |
1b19ea31 | 36 | column \- columnate lists |
6cebde5c | 37 | .SH SYNOPSIS |
07990fdc | 38 | .BR column " [options]" |
c927a0b9 | 39 | .RI [ file ...] |
6cebde5c | 40 | .SH DESCRIPTION |
232dc924 BS |
41 | The |
42 | .B column | |
23609217 KZ |
43 | utility formats its input into multiple columns. The util support three modes: |
44 | .TP | |
0bb7e904 | 45 | .B columns are filled before rows |
23609217 KZ |
46 | This is the default mode (required by backward compatibility). |
47 | .TP | |
0bb7e904 | 48 | .B rows are filled before columns |
1c4c6024 | 49 | This mode is enabled by option \fB\-x, \-\-fillrows\fP |
23609217 | 50 | .TP |
0bb7e904 | 51 | .B table |
23609217 | 52 | Determine the number of columns the input contains and create a table. This |
1c4c6024 | 53 | mode is enabled by option \fB\-t, \-\-table\fP and columns formatting is |
23609217 KZ |
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 | |
dda229c7 | 57 | are ignored and all invalid multibyte sequences are encoded by \\x<hex> convention. |
6cebde5c SK |
58 | .PP |
59 | .SH OPTIONS | |
23609217 KZ |
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 | |
9dbe8e1c KZ |
64 | .IP "\fB\-J, \-\-json\fP" |
65 | Use JSON output format to print the table, the option | |
23609217 | 66 | \fB\-\-table\-columns\fP is required and the option \fB\-\-table\-name\fP is recommended. |
d7a3bf94 KZ |
67 | .IP "\fB\-c, \-\-output\-width\fP \fIwidth\fP" |
68 | Output is formatted to a width specified as number of characters. The original | |
1c4c6024 | 69 | name of this option is \-\-columns; this name is deprecated since v2.30. Note that input |
838ca70c | 70 | longer than \fIwidth\fP is not truncated by default. |
785e5436 KZ |
71 | .IP "\fB\-d, \-\-table\-noheadings\fP" |
72 | Do not print header. This option allows to use logical column names on command line, but keep the header hidden when print the table. | |
b06c1ca6 | 73 | .IP "\fB\-o, \-\-output\-separator\fP \fIstring\fP" |
07990fdc BS |
74 | Specify the columns delimiter for table output (default is two spaces). |
75 | .IP "\fB\-s, \-\-separator\fP \fIseparators\fP" | |
76 | Specify the possible input item delimiters (default is whitespace). | |
6cebde5c | 77 | .IP "\fB\-t, \-\-table\fP" |
6dbe3af9 KZ |
78 | Determine the number of columns the input contains and create a table. |
79 | Columns are delimited with whitespace, by default, or with the characters | |
b06c1ca6 | 80 | supplied using the \fB\-\-output\-separator\fP option. |
c927a0b9 | 81 | Table output is useful for pretty-printing. |
01e335c9 | 82 | .IP "\fB\-N, \-\-table-columns\fP \fInames\fP" |
11a1092a | 83 | Specify the columns names by comma separated list of names. The names are used |
fcf841f8 | 84 | for the table header or to address column in option arguments. |
01e335c9 | 85 | .IP "\fB\-R, \-\-table-right\fP \fIcolumns\fP" |
23609217 | 86 | Right align text in the specified columns. |
3ba01db0 KZ |
87 | .IP "\fB\-T, \-\-table-truncate\fP \fIcolumns\fP" |
88 | Specify columns where is allowed to truncate text when necessary, otherwise | |
23609217 | 89 | very long table entries may be printed on multiple lines. |
1ae24ec2 KZ |
90 | .IP "\fB\-E, \-\-table-noextreme\fP \fIcolumns\fP" |
91 | Specify columns where is possible to ignore unusually long (longer than | |
92 | average) cells when calculate column width. The option has impact to the width | |
c728e000 KZ |
93 | calculation and table formatting, but the printed text is not affected. |
94 | ||
95 | The option is used for the last visible column by default. | |
d9eddf72 KZ |
96 | |
97 | .IP "\fB\-e, \-\-table\-header\-repeat\fP" | |
98 | Print header line for each page. | |
68916af3 KZ |
99 | .IP "\fB\-W, \-\-table-wrap\fP \fIcolumns\fP" |
100 | Specify columns where is possible to use multi-line cell for long text when | |
23609217 | 101 | necessary. |
9624f615 | 102 | .IP "\fB\-H, \-\-table-hide\fP \fIcolumns\fP" |
1c4c6024 BIG |
103 | Don't print specified columns. The special placeholder '\-' may be used to |
104 | hide all unnamed columns (see \-\-table-columns). | |
166271a9 | 105 | .IP "\fB\-O, \-\-table-order\fP \fIcolumns\fP" |
23609217 | 106 | Specify columns order on output. |
9dbe8e1c | 107 | .IP "\fB\-n, \-\-table-name\fP \fIname\fP" |
b9c3b903 | 108 | Specify the table name used for JSON output. The default is "table". |
2698f9ba KZ |
109 | .IP "\fB\-L, \-\-table\-empty\-lines\fP" |
110 | Insert empty line to the table for each empty line on input. The default | |
111 | is ignore empty lines at all. | |
435846ef | 112 | .IP "\fB\-r, \-\-tree\fP \fIcolumn\fP" |
60102db5 KZ |
113 | Specify column to use tree-like output. Note that the circular dependencies and |
114 | another anomalies in child and parent relation are silently ignored. | |
435846ef KZ |
115 | .IP "\fB\-i, \-\-tree\-id\fP \fIcolumn\fP" |
116 | Specify column with line ID to create child-parent relation. | |
117 | .IP "\fB\-p, \-\-tree\-parent\fP \fIcolumn\fP" | |
118 | Specify column with parent ID to create child-parent relation. | |
23609217 | 119 | .PP |
6cebde5c | 120 | .IP "\fB\-x, \-\-fillrows\fP" |
3e094e5f | 121 | Fill rows before filling columns. |
07990fdc BS |
122 | .IP "\fB\-V\fR, \fB\-\-version\fR" |
123 | Display version information and exit. | |
6cebde5c | 124 | .IP "\fB\-h, \-\-help\fP" |
b4362b6f | 125 | Display help text and exit. |
6cebde5c | 126 | .SH ENVIRONMENT |
07990fdc | 127 | The environment variable \fBCOLUMNS\fR is used to determine the size of |
6dbe3af9 | 128 | the screen if no other information is available. |
6cebde5c | 129 | .SH EXAMPLES |
435846ef KZ |
130 | Print fstab with header line and align number to the right: |
131 | .EX | |
1c4c6024 | 132 | \fBsed 's/#.*//' /etc/fstab | column \-\-table \-\-table-columns SOURCE,TARGET,TYPE,OPTIONS,PASS,FREQ \-\-table-right PASS,FREQ\fR |
435846ef | 133 | .EE |
b5de9e69 KZ |
134 | .PP |
135 | Print fstab and hide unnamed columns: | |
136 | .EX | |
1c4c6024 | 137 | \fBsed 's/#.*//' /etc/fstab | column \-\-table \-\-table-columns SOURCE,TARGET,TYPE \-\-table-hide \-\fR |
b5de9e69 KZ |
138 | .EE |
139 | .PP | |
140 | ||
435846ef KZ |
141 | .PP |
142 | Print a tree: | |
143 | .EX | |
1c4c6024 | 144 | \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 |
435846ef | 145 | 1 0 A |
2571d743 SK |
146 | 2 1 |-AA |
147 | 4 2 | |-AAA | |
148 | 5 2 | `-AAB | |
149 | 3 1 `-AB | |
435846ef | 150 | .EE |
018dfb0f | 151 | .SH BUGS |
07990fdc | 152 | Version 2.23 changed the |
018dfb0f SK |
153 | .B \-s |
154 | option to be non-greedy, for example: | |
155 | .PP | |
156 | .EX | |
1c4c6024 | 157 | \fBprintf "a:b:c\\n1::3\\n" | column \-t \-s ':'\fR |
018dfb0f SK |
158 | .EE |
159 | .PP | |
07990fdc | 160 | Old output: |
018dfb0f SK |
161 | .EX |
162 | a b c | |
163 | 1 3 | |
164 | .EE | |
165 | .PP | |
07990fdc | 166 | New output (since util-linux 2.23): |
018dfb0f SK |
167 | .EX |
168 | a b c | |
169 | 1 3 | |
170 | .EE | |
1ec4c065 | 171 | .PP |
172 | Historical versions of this tool indicated that "rows are filled before | |
173 | columns" by default, and that the | |
174 | .B \-x | |
175 | option reverses this. This wording did not reflect the actual behavior, and it | |
176 | has since been corrected (see above). Other implementations of | |
177 | .B column | |
178 | may continue to use the older documentation, but the behavior should be | |
179 | identical in any case. | |
5a829806 | 180 | .SH SEE ALSO |
6cebde5c SK |
181 | .BR colrm (1), |
182 | .BR ls (1), | |
183 | .BR paste (1), | |
184 | .BR sort (1) | |
185 | .SH HISTORY | |
186 | The column command appeared in 4.3BSD-Reno. | |
187 | .SH AVAILABILITY | |
601d12fb | 188 | The column command is part of the util-linux package and is available from |
d673b74e | 189 | https://www.kernel.org/pub/linux/utils/util-linux/. |