xref: /freebsd/usr.bin/col/col.1 (revision bdcbfde31e8e9b343f113a1956384bdf30d1ed62)
19b50d902SRodney W. Grimes.\" Copyright (c) 1990, 1993
29b50d902SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
39b50d902SRodney W. Grimes.\"
49b50d902SRodney W. Grimes.\" This code is derived from software contributed to Berkeley by
59b50d902SRodney W. Grimes.\" Michael Rendell.
69b50d902SRodney W. Grimes.\"
79b50d902SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
89b50d902SRodney W. Grimes.\" modification, are permitted provided that the following conditions
99b50d902SRodney W. Grimes.\" are met:
109b50d902SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
119b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
129b50d902SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
139b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
149b50d902SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
15fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors
169b50d902SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
179b50d902SRodney W. Grimes.\"    without specific prior written permission.
189b50d902SRodney W. Grimes.\"
199b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
209b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
219b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
229b50d902SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
239b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
249b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
259b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
269b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
279b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
289b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
299b50d902SRodney W. Grimes.\" SUCH DAMAGE.
309b50d902SRodney W. Grimes.\"
31*8a27a637SFernando Apesteguía.Dd October 21, 2020
329b50d902SRodney W. Grimes.Dt COL 1
339b50d902SRodney W. Grimes.Os
349b50d902SRodney W. Grimes.Sh NAME
359b50d902SRodney W. Grimes.Nm col
369b50d902SRodney W. Grimes.Nd filter reverse line feeds from input
379b50d902SRodney W. Grimes.Sh SYNOPSIS
388fe908efSRuslan Ermilov.Nm
39844518ffSMike Heffner.Op Fl bfhpx
409b50d902SRodney W. Grimes.Op Fl l Ar num
419b50d902SRodney W. Grimes.Sh DESCRIPTION
423898680cSPhilippe CharnierThe
433898680cSPhilippe Charnier.Nm
443898680cSPhilippe Charnierutility filters out reverse (and half reverse) line feeds so that the output is
459b50d902SRodney W. Grimesin the correct order with only forward and half forward line
469b50d902SRodney W. Grimesfeeds, and replaces white-space characters with tabs where possible.
479b50d902SRodney W. Grimes.Pp
483898680cSPhilippe CharnierThe
493898680cSPhilippe Charnier.Nm
503898680cSPhilippe Charnierutility reads from the standard input and writes to the standard output.
519b50d902SRodney W. Grimes.Pp
529b50d902SRodney W. GrimesThe options are as follows:
53a292105aSPhilippe Charnier.Bl -tag -width indent
549b50d902SRodney W. Grimes.It Fl b
559b50d902SRodney W. GrimesDo not output any backspaces, printing only the last character
569b50d902SRodney W. Grimeswritten to each column position.
579b50d902SRodney W. Grimes.It Fl f
589b50d902SRodney W. GrimesForward half line feeds are permitted (``fine'' mode).
599b50d902SRodney W. GrimesNormally characters printed on a half line boundary are printed
609b50d902SRodney W. Grimeson the following line.
6143d665c0SDima Dorfman.It Fl h
620227791bSRuslan ErmilovDo not output multiple spaces instead of tabs (default).
63a51b574cSTim J. Robbins.It Fl l Ar num
64a51b574cSTim J. RobbinsBuffer at least
65a51b574cSTim J. Robbins.Ar num
66a51b574cSTim J. Robbinslines in memory.
67a51b574cSTim J. RobbinsBy default, 128 lines are buffered.
68844518ffSMike Heffner.It Fl p
69844518ffSMike HeffnerForce unknown control sequences to be passed through unchanged.
70844518ffSMike HeffnerNormally,
71844518ffSMike Heffner.Nm
72844518ffSMike Heffnerwill filter out any control sequences from the input other than those
73844518ffSMike Heffnerrecognized and interpreted by itself, which are listed below.
749b50d902SRodney W. Grimes.It Fl x
759b50d902SRodney W. GrimesOutput multiple spaces instead of tabs.
769b50d902SRodney W. Grimes.El
779b50d902SRodney W. Grimes.Pp
787bc60a16SBaptiste DaroussinIn the input stream,
79a292105aSPhilippe Charnier.Nm
807bc60a16SBaptiste Daroussinunderstands both the escape sequences of the form escape-digit
817bc60a16SBaptiste Daroussinmandated by
827bc60a16SBaptiste Daroussin.St -susv2
837bc60a16SBaptiste Daroussinand the traditional
847bc60a16SBaptiste Daroussin.Bx
857bc60a16SBaptiste Daroussinformat escape-control-character.
867bc60a16SBaptiste DaroussinThe control sequences for carriage motion and their ASCII values
877bc60a16SBaptiste Daroussinare as follows:
889b50d902SRodney W. Grimes.Pp
899b50d902SRodney W. Grimes.Bl -tag -width "carriage return" -compact
907bc60a16SBaptiste Daroussin.It ESC\-BELL
917bc60a16SBaptiste Daroussinreverse line feed (escape then bell).
929b50d902SRodney W. Grimes.It ESC\-7
937bc60a16SBaptiste Daroussinreverse line feed (escape then 7).
947bc60a16SBaptiste Daroussin.It ESC\-BACKSPACE
957bc60a16SBaptiste Daroussinhalf reverse line feed (escape then backspace).
969b50d902SRodney W. Grimes.It ESC\-8
977bc60a16SBaptiste Daroussinhalf reverse line feed (escape then 8).
987bc60a16SBaptiste Daroussin.It ESC\-TAB
997bc60a16SBaptiste Daroussinhalf forward line feed (escape than tab).
1009b50d902SRodney W. Grimes.It ESC\-9
1017bc60a16SBaptiste Daroussinhalf forward line feed (escape then 9).
1027bc60a16SBaptiste DaroussinIn
1037bc60a16SBaptiste Daroussin.Fl f
1047bc60a16SBaptiste Daroussinmode, this sequence may also occur in the output stream.
1059b50d902SRodney W. Grimes.It backspace
1069b50d902SRodney W. Grimesmoves back one column (8); ignored in the first column
1079b50d902SRodney W. Grimes.It carriage return
1089b50d902SRodney W. Grimes(13)
1099b50d902SRodney W. Grimes.It newline
1109b50d902SRodney W. Grimesforward line feed (10); also does carriage return
1119b50d902SRodney W. Grimes.It shift in
1129b50d902SRodney W. Grimesshift to normal character set (15)
1139b50d902SRodney W. Grimes.It shift out
1149b50d902SRodney W. Grimesshift to alternate character set (14)
1159b50d902SRodney W. Grimes.It space
1169b50d902SRodney W. Grimesmoves forward one column (32)
1179b50d902SRodney W. Grimes.It tab
1189b50d902SRodney W. Grimesmoves forward to next tab stop (9)
1199b50d902SRodney W. Grimes.It vertical tab
1209b50d902SRodney W. Grimesreverse line feed (11)
1219b50d902SRodney W. Grimes.El
1229b50d902SRodney W. Grimes.Pp
1239b50d902SRodney W. GrimesAll unrecognized control characters and escape sequences are
1249b50d902SRodney W. Grimesdiscarded.
1259b50d902SRodney W. Grimes.Pp
1263898680cSPhilippe CharnierThe
1273898680cSPhilippe Charnier.Nm
1283898680cSPhilippe Charnierutility keeps track of the character set as characters are read and makes
1299b50d902SRodney W. Grimessure the character set is correct when they are output.
1309b50d902SRodney W. Grimes.Pp
1319b50d902SRodney W. GrimesIf the input attempts to back up to the last flushed line,
132a292105aSPhilippe Charnier.Nm
1339b50d902SRodney W. Grimeswill display a warning message.
134c3fae744STim J. Robbins.Sh ENVIRONMENT
135c3fae744STim J. RobbinsThe
136c3fae744STim J. Robbins.Ev LANG , LC_ALL
137c3fae744STim J. Robbinsand
138c3fae744STim J. Robbins.Ev LC_CTYPE
139c3fae744STim J. Robbinsenvironment variables affect the execution of
140c3fae744STim J. Robbins.Nm
141c3fae744STim J. Robbinsas described in
142c3fae744STim J. Robbins.Xr environ 7 .
143a866e170SRuslan Ermilov.Sh EXIT STATUS
144ff1b94f0STim J. Robbins.Ex -std
145*8a27a637SFernando Apesteguía.Sh EXAMPLES
146*8a27a637SFernando ApesteguíaWe can use
147*8a27a637SFernando Apesteguía.Nm
148*8a27a637SFernando Apesteguíato filter the output of
149*8a27a637SFernando Apesteguía.Xr man 1
150*8a27a637SFernando Apesteguíaand remove the backspace characters (
151*8a27a637SFernando Apesteguía.Em ^H
152*8a27a637SFernando Apesteguía) before searching for some text:
153*8a27a637SFernando Apesteguía.Bd -literal -offset indent
154*8a27a637SFernando Apesteguíaman ls | col -b | grep HISTORY
155*8a27a637SFernando Apesteguía.Ed
1569b50d902SRodney W. Grimes.Sh SEE ALSO
157*8a27a637SFernando Apesteguía.Xr expand 1
158debb1842STim J. Robbins.Sh STANDARDS
159debb1842STim J. RobbinsThe
160debb1842STim J. Robbins.Nm
161debb1842STim J. Robbinsutility conforms to
162debb1842STim J. Robbins.St -susv2 .
1639b50d902SRodney W. Grimes.Sh HISTORY
1649b50d902SRodney W. GrimesA
165a292105aSPhilippe Charnier.Nm
1669b50d902SRodney W. Grimescommand
1670f778506SMike Pritchardappeared in
1680f778506SMike Pritchard.At v6 .
169