]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.bin/col/col.1
MFV: xz 5.4.5
[FreeBSD/FreeBSD.git] / usr.bin / col / col.1
1 .\" Copyright (c) 1990, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" This code is derived from software contributed to Berkeley by
5 .\" Michael Rendell.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\"    notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\"    notice, this list of conditions and the following disclaimer in the
14 .\"    documentation and/or other materials provided with the distribution.
15 .\" 3. Neither the name of the University nor the names of its contributors
16 .\"    may be used to endorse or promote products derived from this software
17 .\"    without specific prior written permission.
18 .\"
19 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 .\" SUCH DAMAGE.
30 .\"
31 .\"     @(#)col.1       8.1 (Berkeley) 6/29/93
32 .\"
33 .Dd October 21, 2020
34 .Dt COL 1
35 .Os
36 .Sh NAME
37 .Nm col
38 .Nd filter reverse line feeds from input
39 .Sh SYNOPSIS
40 .Nm
41 .Op Fl bfhpx
42 .Op Fl l Ar num
43 .Sh DESCRIPTION
44 The
45 .Nm
46 utility filters out reverse (and half reverse) line feeds so that the output is
47 in the correct order with only forward and half forward line
48 feeds, and replaces white-space characters with tabs where possible.
49 .Pp
50 The
51 .Nm
52 utility reads from the standard input and writes to the standard output.
53 .Pp
54 The options are as follows:
55 .Bl -tag -width indent
56 .It Fl b
57 Do not output any backspaces, printing only the last character
58 written to each column position.
59 .It Fl f
60 Forward half line feeds are permitted (``fine'' mode).
61 Normally characters printed on a half line boundary are printed
62 on the following line.
63 .It Fl h
64 Do not output multiple spaces instead of tabs (default).
65 .It Fl l Ar num
66 Buffer at least
67 .Ar num
68 lines in memory.
69 By default, 128 lines are buffered.
70 .It Fl p
71 Force unknown control sequences to be passed through unchanged.
72 Normally,
73 .Nm
74 will filter out any control sequences from the input other than those
75 recognized and interpreted by itself, which are listed below.
76 .It Fl x
77 Output multiple spaces instead of tabs.
78 .El
79 .Pp
80 In the input stream,
81 .Nm
82 understands both the escape sequences of the form escape-digit
83 mandated by
84 .St -susv2
85 and the traditional
86 .Bx
87 format escape-control-character.
88 The control sequences for carriage motion and their ASCII values
89 are as follows:
90 .Pp
91 .Bl -tag -width "carriage return" -compact
92 .It ESC\-BELL
93 reverse line feed (escape then bell).
94 .It ESC\-7
95 reverse line feed (escape then 7).
96 .It ESC\-BACKSPACE
97 half reverse line feed (escape then backspace).
98 .It ESC\-8
99 half reverse line feed (escape then 8).
100 .It ESC\-TAB
101 half forward line feed (escape than tab).
102 .It ESC\-9
103 half forward line feed (escape then 9).
104 In
105 .Fl f
106 mode, this sequence may also occur in the output stream.
107 .It backspace
108 moves back one column (8); ignored in the first column
109 .It carriage return
110 (13)
111 .It newline
112 forward line feed (10); also does carriage return
113 .It shift in
114 shift to normal character set (15)
115 .It shift out
116 shift to alternate character set (14)
117 .It space
118 moves forward one column (32)
119 .It tab
120 moves forward to next tab stop (9)
121 .It vertical tab
122 reverse line feed (11)
123 .El
124 .Pp
125 All unrecognized control characters and escape sequences are
126 discarded.
127 .Pp
128 The
129 .Nm
130 utility keeps track of the character set as characters are read and makes
131 sure the character set is correct when they are output.
132 .Pp
133 If the input attempts to back up to the last flushed line,
134 .Nm
135 will display a warning message.
136 .Sh ENVIRONMENT
137 The
138 .Ev LANG , LC_ALL
139 and
140 .Ev LC_CTYPE
141 environment variables affect the execution of
142 .Nm
143 as described in
144 .Xr environ 7 .
145 .Sh EXIT STATUS
146 .Ex -std
147 .Sh EXAMPLES
148 We can use
149 .Nm
150 to filter the output of
151 .Xr man 1
152 and remove the backspace characters (
153 .Em ^H
154 ) before searching for some text:
155 .Bd -literal -offset indent
156 man ls | col -b | grep HISTORY
157 .Ed
158 .Sh SEE ALSO
159 .Xr expand 1
160 .Sh STANDARDS
161 The
162 .Nm
163 utility conforms to
164 .St -susv2 .
165 .Sh HISTORY
166 A
167 .Nm
168 command
169 appeared in
170 .At v6 .