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