首页

col

col
功能说明:过滤控制字符。
语  法:col [-bfx][-l<缓冲区列数>]
补充说明:在许多UNIX说明文件里,都有RLF控制字符。当我们运用shell特殊字符">"和">>",把说明文件的内容输出成纯文本文件时,控制字符会变成乱码,col指令则能有效滤除这些控制字符。
参  数:
  -b   过滤掉所有的控制字符,包括RLF和HRLF。
  -f   滤除RLF字符,但允许将HRLF字符呈现出来。
  -x   以多个空格字符来表示跳格字符。
  -l<缓冲区列数>   预设的内存缓冲区有128列,您可以自行指定缓冲区的大小。

col

col [options]

A postprocessing filter that handles reverse linefeeds and escape characters, allowing output from tbl or nroff to appear in reasonable form on a terminal.

Options

-b

Ignore backspace characters; helpful when printing manpages.

-f

Process half-line vertical motions, but not reverse line motion. (Normally, half-line input motion is displayed on the next full line.)

-l n

Buffer at least n lines in memory. The default buffer size is 128 lines.

-x

Normally, col saves printing time by converting sequences of spaces to tabs. Use -x to suppress this conversion.

Examples

Run myfile through tbl and nroff, then capture output on screen by filtering through col and more:

tbl myfile | nroff | col | more

Save manpage output for the ls command in out.print, stripping out backspaces (which would otherwise appear as ^H):

man ls | col -b > out.print