LinuxCommandLibrary

col

Filter out reverse line feeds

SYNOPSIS

col [-bfhlpx] [-cnumber]

PARAMETERS

-b
    Do not output any backspaces. Backspaces can be used to create bold or underlined text by overstriking characters.

-f
    Fine, allow half line feed. Normally, col will delete lines generated by a half line feed or reverse half line feed. Mainly useful with table.

-h
    Output multiple spaces as sequences of space-tab-space, rather than as tabs. Normally, col will use tabs wherever possible to reduce the output size.

-l number
    Buffer at least number lines in memory. By default, only 128 lines are buffered. More may be needed to handle complex input.

-p
    Force unknown control characters to be passed through. Normally, col strips out any control characters that it does not recognize.

-x
    Replace multiple white space characters by tabs.

-c number
    Use number as the buffer size.

DESCRIPTION

The col command filters out reverse line feeds from its input. It's primarily used to convert text files containing reverse line feeds into a format suitable for printing or displaying on a terminal.

Reverse line feeds are often used by older text processing programs to produce underlined or overstruck text. col processes the input, interpreting special characters like backspace, carriage return, and line feed to create a final output without these reverse motions. It is commonly used to prepare files generated by nroff or tbl (part of the traditional Unix typesetting system) for output on devices that cannot handle reverse line feeds directly. It handles various escape sequences used in formatting. The standard behavior is to replace whitespace with tabs where possible to minimize output size.

CAVEATS

col is designed primarily for processing files generated by older typesetting tools. Its usefulness may be limited with modern text formats. Handling of complex character encodings might not be fully supported.

USAGE EXAMPLE

Convert an nroff output file to plain text for printing: col -b < file.nroff > file.txt

HISTORY

The col command has been a part of Unix systems since the early days. It was initially developed to assist in processing output from text formatting tools like nroff and tbl, which produced files containing reverse line feeds for underlining and other special effects. As terminal technology evolved, and the need for reverse line feeds diminished, the command became less frequently used but remains available for compatibility and for handling legacy files.

SEE ALSO

nroff(1), tbl(1)

Copied to clipboard