Linux command
col 命令
文本
涉及管道、覆盖或删除,执行前请先确认路径和参数。
常用示例
Example
command | col
Example
command | col -x
Example
command | col -b
Example
command | col -l 256
Example
man ls | col -b | less
说明
col filters reverse line feeds and half-reverse line feeds from input text, ensuring output displays in the correct order on terminals that cannot handle these control sequences. It's a text processing filter that resolves line feed conflicts and optimizes whitespace representation. The utility is particularly useful for processing output from nroff, tbl, and other text formatting commands that use reverse line feeds for underlining and overstriking. By default, col converts sequences of spaces to tabs for efficiency, though this can be disabled with the -x flag. Originally designed for printing formatted text on line printers and simple terminals, col remains useful for converting man page output to plain text, preprocessing formatted documents, and handling legacy text formats. It reads from standard input and writes cleaned output to standard output, making it suitable for Unix pipelines.
参数
- -b, --no-backspaces
- Do not output backspaces; display only the final character at each position
- -f, --fine
- Enable half-forward line feeds (normally deferred to the following line)
- -h, --tabs
- Convert multiple spaces to tab characters
- -l, --lines NUM
- Set memory buffer to at least NUM lines (default: 128)
- -p, --pass
- Allow unrecognized control sequences to pass through unchanged
- -x, --spaces
- Output multiple spaces instead of tabs
- -H, --help
- Display help information and exit
- -V, --version
- Display version information and exit
FAQ
What is the col command used for?
col filters reverse line feeds and half-reverse line feeds from input text, ensuring output displays in the correct order on terminals that cannot handle these control sequences. It's a text processing filter that resolves line feed conflicts and optimizes whitespace representation. The utility is particularly useful for processing output from nroff, tbl, and other text formatting commands that use reverse line feeds for underlining and overstriking. By default, col converts sequences of spaces to tabs for efficiency, though this can be disabled with the -x flag. Originally designed for printing formatted text on line printers and simple terminals, col remains useful for converting man page output to plain text, preprocessing formatted documents, and handling legacy text formats. It reads from standard input and writes cleaned output to standard output, making it suitable for Unix pipelines.
How do I run a basic col example?
Run `command | col` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -b, --no-backspaces do in col?
Do not output backspaces; display only the final character at each position