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