[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 1

col Command


Filters for standard output text having reverse line feeds and forward/reverse half-line-feeds.


col-b ] [ -f ] [ -p ] [ -x ] [  -T Name ] [ -l Number ]


The col command reads a text file from standard input and writes to standard output. It performs the line overlays implied by the flr commands (reverse line feeds), as well as by the hlf and hlr commands (forward and reverse half-line-feed, respectively). The nterm file format document gives a description of these line-feed commands. Use the col command for filtering multicolumn output produced by the nroff command, the .rt request, and by output from the tbl command.

Use the col command as an nroff backend filter for devices that cannot handle reverse line motions (such as most impact printers). To print correctly, use the col command to process outputs from the tbl command, the neqn command, or explicit reverse motion request files (such as the .sp -10V file), or files with 2-column output. Do not process the nroff output targeted for the following devices with the col command:

Unless the -x flag is given, whenever possible, the col command converts white spaces to tabs upon output wherever possible to shorten printing time.

The col command, used with the -T37 file, assumes the ASCII control characters, SO (\017) and SI (\016), begin and end text in an alternate character set. The col command remembers the character set each input character belongs to and upon output, generates SI and SO characters as appropriate to ensure that each character is printed in the correct character set.

Upon input, the col command accepts only the control characters for the Space, Backspace, Tab, and Return keys; the new-line character; the SI, SO (with the -T37 file), and VT control characters; and the reverse line feed, forward half-line-feed and reverse half-line-feed characters. The VT control character (\013) is an alternate form of full reverse line feed, included for compatibility with some earlier programs of this type. The col command ignores all other nonprinting characters.

Normally, the col command ignores any escape sequences that are unknown to it and found in the input. However, the -p option can be used to cause the col command to output these sequences as regular characters, subject to overprinting from reverse line motions. The use of this option is highly discouraged unless the user is fully aware of the textual position of the escape sequences.

  1. If the output is being sent to a device that can interpret half-line motions, enter:

    nroff -Tppds File... | col -f -Tppds

    Otherwise, for example, enter:

    nroff -Tlp File... | col -Tlp 
  2. The maximum number of lines that can be backed up is 128.
  3. No more than 800 characters, including backspaces, are allowed on a line.
  4. Local vertical motions that would result in backing up over the first line are ignored. As a result, the first line must not contain any superscripts.


-b Assumes that the output device in use is not capable of backspacing. In this case, if two or more characters are to be displayed in the same position, only the last one that is read is displayed in the output.
-f Suppresses the default treatment of half-line motions in the input. Normally, the col command does not emit half-line motions on output, although it does accept them in its input. With this flag, output can contain forward half-line-feeds (hlf) but not reverse line feeds (flr or hlr).
-p Displays unknown escape sequences as characters, subject to overprinting from reverse line motions. Normally, the col command ignores them.
-x Converts tabs to white space.
-TName Uses the workstation specification indicated by the Name variable. Name varables for "Terminal Names for Typewriter-like Devices and Line Printers" are discussed in the nroff command -TName flag. The default is 37.
-l Number (lowercase L) Sends the specified number lines of text in memory to a buffer during processing.

Exit Status

The following exit values are returned:

0 Indicates successful completion.
>0 Indicates an error occurred.

Related Information

The hplj command, mm command, nroff command, ps4014 command, tbl command.

The nterm file format.

[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]