Name: col Description: filter reverse line feeds from input Author: Ronald J Kimball, firstname.lastname@example.org License: perl
col - filter reverse line feeds from input
col [-bfpx] [-l num] [-Eest]
col filters out reverse (and half-reverse) line feeds so that the output is in the correct order with only forward and half-forward line feeds, and replaces whitespace characters with tabs where possible. This can be useful in processing the output of nroff(1) and tbl(1).
col reads from the standard input and writes to the standard output.
col accepts the following standard options:
Do not output any backspaces, printing only the last character written to each column position.
Forward half-line feeds are permitted ("fine" mode). Without this option, characters which would be printed on a half-line boundary are printed on the following line.
Output unrecognized escape sequences. Without this option, unrecognized escape sequences are ignored. Because escape sequences may be overprinted from reverse line feeds, the use of this option is highly discouraged unless the user is fully aware of the textual position of the escape sequences.
Output multiple spaces instead of tabs. Tab stops are eight characters apart.
Buffer at least num lines in memory. By default 256 lines (or 512 half-lines) are buffered.
col also accepts the following options for compatibility with other implementations:
Accept only IRIX-style escape sequences; a reverse line feed is an escape followed by the ASCII character 7. The -E option overrides the -e option.
Accept only BSD-style escape sequences; a reverse line feed is an escape followed by the ASCII character whose decimal value is 7 (control-g). The -e option is overriden by the -E option.
If neither the -E nor the -e option is used, col accepts both BSD and IRIX style escapes sequences.
Shift in before each line feed when in the alternate character set (as in IRIX col). Without this option, col only shifts in before the final line endings (as in BSD col).
Ignore trailing input that is not followed by a line feed (as in IRIX col). Without this option, a final line feed is not necessary (as in BSD col.)
The control sequences and their decimal ASCII values that col understands are listed in the following table:
ESC-7 Reverse line feed (escape then 7). ESC-8 Half reverse line feed (escape then 8). ESC-9 Half forward line feed (escape then 9). backspace Moves back one column (8); ignored in the first column. carriage return (13) newline Forward line feed (10); also does carriage return. shift in Shift to normal character set (15). shift out Shift to alternate character set (14). space Moves forward one column (32). tab Moves forward to next tab stop (9). vertical tab Reverse line feed (11).
(See the explanations of -e and -E for more about escapes and line feeds.)
This implementation of col has no known bugs.
Reverse line feeds and half reverse line feeds which would move past the start of the buffer are ignored.
Unrecognized control characters are ignored.
Unrecognized escape sequences are ignored, unless the -p option is used.
Some versions of col for BSD may convert spaces to tabs incorrectly. This implementation of col does not emulate that bug.
This implementation of col was compared to the col utility on IRIX and BSD, and includes compatibility modes for both those systems. The col utilities on other systems may have further differences in behavior.
This implementation of col in Perl was written by Ronald J Kimball, email@example.com
This program is copyright 2000 by Ronald J Kimball.
This program is free and open software. You may use, modify, or distribute this program (and any modified variants) in any way you wish, provided you do not restrict others from doing the same.