|Previous||Table of Contents||Next|
The external col command removes control characters from the input text. This lets you display text on your terminal or send it to a printer that does not support such control characters. The input for col must always be the standard input (col cannot read from files). The output is always the standard output. The most common use of col is in a pipe command after an nroff type command. The nroff command is a typesetting processor. The col command accepts eleven different control code sequences from the input. The output is physically converted to appear as similar to the original input text as possible without using special characters.
Following is the general format of the col command.
col [ -bfpx ]
|col [ -bfh ]|
The following options may be used to control how col functions.
|-b||Implies that the output device cannot backspace. Therefore, if multiple characters are to appear at the same location, only the last character is displayed. For example,|
|displays _ (underscore); the H is ignored.|
|-f||Does not remove half line feed (Esc-9) sequences from the text. Normally half line feeds are converted to full line feeds.|
|-p||Passes unknown escape sequences to the output. Normally col removes all escape sequences from the text.|
|-x||Suppresses the conversion of multiple space characters to tabs. By default, col converts a specific number of spaces to a single tab. Usually eight spaces are converted to one tab.|
|-h||Converts white space (spaces) to tabs to shorten printing time.|
The col command does not accept filenames for input. Thus you must pipe the input to col or use indirection signs. For example,
cj> env | col cj> cat mydoc | col cj> col < mydoc
The control characters converted by col are listed in the following table. Each character or set of characters usually provides a common display control sequence.
|Character||Name||ASCII Code (OCTAL) @LIST =|
|Ctrl-H (^H)||Backspace (BS)||010|
|Ctrl-I (^I)||Tab (HT)||011|
|Ctrl-J (^J)||Linefeed (LF)||012|
|Ctrl-K (^K)||Vertical Tab (VT)||013|
|Ctrl-M (^M)||Carriage Return (CR)||015|
|Ctrl-N (^N)||Start-of-text (SO)||016|
|Ctrl-O (^O)||End-of-text (SI)||017|
|The following escape sequences are converted by col.|
|Esc-7||Reverse line feed||033 067|
|Esc-8||Reverse half line feed||033 070|
|Esc-9||Forward half line feed||033 071|
DIAGNOSTICS AND BUGS
The col command retains the last 128 lines of text. Therefore, it cannot back up more than 128 lines to perform certain reformatting.
The longest line must not exceed 800 characters, including control characters.
The first line of your document must not contain subscripting since col ignores control characters on the first line.
The col command can only read from the standard input and write to the standard output.
The most common use of the col command is with the text processing nroff command. But it is also handy for displaying files that contain control sequences that garble your terminal screen. For example, you may have a man page that you often reference stored in a file. If you created the man page on a different terminal type than the one you currently use, the man page may not appear correctly. Therefore, you might use col to remove the control characters so the man page appears in a readable format.
In this activity you use the col command to display a man page output. But your terminal type is set to the wrong type, so you would get garbled output on your screen if you did not use col. Begin at the shell prompt.
|If you are using the csh, type setenv TERM tvi925 and press Return.|
Normally you have the TERM variable set to the proper terminal type. This activity is just an example of how col functions.
|Previous||Table of Contents||Next|