]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.bin/col/col.1
Update to bmake-20240108
[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 .Dd October 21, 2020
32 .Dt COL 1
33 .Os
34 .Sh NAME
35 .Nm col
36 .Nd filter reverse line feeds from input
37 .Sh SYNOPSIS
38 .Nm
39 .Op Fl bfhpx
40 .Op Fl l Ar num
41 .Sh DESCRIPTION
42 The
43 .Nm
44 utility filters out reverse (and half reverse) line feeds so that the output is
45 in the correct order with only forward and half forward line
46 feeds, and replaces white-space characters with tabs where possible.
47 .Pp
48 The
49 .Nm
50 utility reads from the standard input and writes to the standard output.
51 .Pp
52 The options are as follows:
53 .Bl -tag -width indent
54 .It Fl b
55 Do not output any backspaces, printing only the last character
56 written to each column position.
57 .It Fl f
58 Forward half line feeds are permitted (``fine'' mode).
59 Normally characters printed on a half line boundary are printed
60 on the following line.
61 .It Fl h
62 Do not output multiple spaces instead of tabs (default).
63 .It Fl l Ar num
64 Buffer at least
65 .Ar num
66 lines in memory.
67 By default, 128 lines are buffered.
68 .It Fl p
69 Force unknown control sequences to be passed through unchanged.
70 Normally,
71 .Nm
72 will filter out any control sequences from the input other than those
73 recognized and interpreted by itself, which are listed below.
74 .It Fl x
75 Output multiple spaces instead of tabs.
76 .El
77 .Pp
78 In the input stream,
79 .Nm
80 understands both the escape sequences of the form escape-digit
81 mandated by
82 .St -susv2
83 and the traditional
84 .Bx
85 format escape-control-character.
86 The control sequences for carriage motion and their ASCII values
87 are as follows:
88 .Pp
89 .Bl -tag -width "carriage return" -compact
90 .It ESC\-BELL
91 reverse line feed (escape then bell).
92 .It ESC\-7
93 reverse line feed (escape then 7).
94 .It ESC\-BACKSPACE
95 half reverse line feed (escape then backspace).
96 .It ESC\-8
97 half reverse line feed (escape then 8).
98 .It ESC\-TAB
99 half forward line feed (escape than tab).
100 .It ESC\-9
101 half forward line feed (escape then 9).
102 In
103 .Fl f
104 mode, this sequence may also occur in the output stream.
105 .It backspace
106 moves back one column (8); ignored in the first column
107 .It carriage return
108 (13)
109 .It newline
110 forward line feed (10); also does carriage return
111 .It shift in
112 shift to normal character set (15)
113 .It shift out
114 shift to alternate character set (14)
115 .It space
116 moves forward one column (32)
117 .It tab
118 moves forward to next tab stop (9)
119 .It vertical tab
120 reverse line feed (11)
121 .El
122 .Pp
123 All unrecognized control characters and escape sequences are
124 discarded.
125 .Pp
126 The
127 .Nm
128 utility keeps track of the character set as characters are read and makes
129 sure the character set is correct when they are output.
130 .Pp
131 If the input attempts to back up to the last flushed line,
132 .Nm
133 will display a warning message.
134 .Sh ENVIRONMENT
135 The
136 .Ev LANG , LC_ALL
137 and
138 .Ev LC_CTYPE
139 environment variables affect the execution of
140 .Nm
141 as described in
142 .Xr environ 7 .
143 .Sh EXIT STATUS
144 .Ex -std
145 .Sh EXAMPLES
146 We can use
147 .Nm
148 to filter the output of
149 .Xr man 1
150 and remove the backspace characters (
151 .Em ^H
152 ) before searching for some text:
153 .Bd -literal -offset indent
154 man ls | col -b | grep HISTORY
155 .Ed
156 .Sh SEE ALSO
157 .Xr expand 1
158 .Sh STANDARDS
159 The
160 .Nm
161 utility conforms to
162 .St -susv2 .
163 .Sh HISTORY
164 A
165 .Nm
166 command
167 appeared in
168 .At v6 .