1.\"	$MirOS: src/usr.bin/col/col.1,v 1.6 2008/08/02 00:57:31 tg Exp $
2.\"	$OpenBSD: col.1,v 1.8 2003/06/03 02:56:06 millert Exp $
3.\"	$NetBSD: col.1,v 1.4 1995/03/26 05:25:52 glass Exp $
4.\"
5.\" Copyright (c) 1990, 1993
6.\"	The Regents of the University of California.  All rights reserved.
7.\"
8.\" This code is derived from software contributed to Berkeley by
9.\" Michael Rendell.
10.\"
11.\" Redistribution and use in source and binary forms, with or without
12.\" modification, are permitted provided that the following conditions
13.\" are met:
14.\" 1. Redistributions of source code must retain the above copyright
15.\"    notice, this list of conditions and the following disclaimer.
16.\" 2. Redistributions in binary form must reproduce the above copyright
17.\"    notice, this list of conditions and the following disclaimer in the
18.\"    documentation and/or other materials provided with the distribution.
19.\" 3. Neither the name of the University nor the names of its contributors
20.\"    may be used to endorse or promote products derived from this software
21.\"    without specific prior written permission.
22.\"
23.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE.
34.\"
35.\"     @(#)col.1	8.1 (Berkeley) 6/29/93
36.\"
37.Dd $Mdocdate: August 2 2008 $
38.Dt COL 1
39.Os
40.Sh NAME
41.Nm col
42.Nd filter reverse line feeds from input
43.Sh SYNOPSIS
44.Nm col
45.Op Fl bfhx
46.Op Fl l Ar num
47.Sh DESCRIPTION
48.Nm
49filters out reverse (and half-reverse) line feeds so that the output is
50in the correct order with only forward and half-forward line
51feeds, and replaces whitespace characters with tabs where possible.
52This can be useful in processing the output of
53.Xr nroff 1
54and
55.Xr tbl 1 .
56.Pp
57.Nm
58reads from the standard input and writes to the standard output.
59.Pp
60The options are as follows:
61.Bl -tag -width Ds
62.It Fl b
63Do not output any backspaces, printing only the last character
64written to each column position.
65.It Fl f
66Forward half-line feeds are permitted
67.Pf ( Ns Dq fine
68mode).
69Normally characters printed on a half-line boundary are printed
70on the following line.
71.It Fl h
72Compress spaces into tabs.
73This is the default behavior.
74.It Fl x
75Output multiple spaces instead of tabs.
76.It Fl l Ar num
77Buffer at least
78.Ar num
79lines in memory.
80By default, 256 lines are buffered.
81.El
82.Pp
83The control sequences for carriage motion that
84.Nm
85understands and their decimal values are listed in the following
86table:
87.Pp
88.Bl -tag -width "carriage return" -compact
89.It ESC\-7
90Reverse line feed (escape then 7).
91.It ESC\-10
92Half reverse line feed (escape then 10).
93.It ESC\-11
94Half forward line feed (escape then 11).
95.It backspace
96Moves back one column (8); ignored in the first column.
97.It carriage return
98Move back to first column (13).
99.It newline
100Forward line feed (10); also does carriage return.
101.It shift in
102Shift to normal character set (15).
103.It shift out
104Shift to alternate character set (14).
105.It space
106Moves forward one column (32).
107.It tab
108Moves forward to next tab stop (9).
109.It vertical tab
110Reverse line feed (11).
111.El
112.Pp
113All unrecognised control characters and escape sequences are
114discarded.
115.Pp
116.Nm
117keeps track of the character set as characters are read and makes
118sure the character set is correct when they are output.
119.Pp
120If the input attempts to back up to the last flushed line,
121.Nm
122will display a warning message.
123.Sh SEE ALSO
124.Xr expand 1 ,
125.Xr nroff 1 ,
126.Xr tbl 1
127.Sh HISTORY
128A
129.Nm
130command appeared in
131.At v6 .
132It was made locale aware in
133.Mx 10 .
134