Linux col command

Linux 命令大全Linux Command Reference

The Linux col command is used to filter control characters.

In many UNIX documentation files, there are RLF control characters. When we use the shell special characters ">" and ">>" to output the content of documentation files as plain text files, the control characters become garbled. The col command can effectively filter out these control characters.

Syntax

col [-bfx][-l<缓冲区列数>] 

Parameters:

  • -b Filter out all control characters, including RLF and HRLF.
  • -f Filter out RLF characters, but allow HRLF characters to be displayed.
  • -x Represent tab characters with multiple space characters.
  • -l<buffer columns> The default memory buffer has 128 columns. You can specify the buffer size yourself.

Examples

Below, using the man command help documentation as an example, we explain the usage of the col command.

Save the man command's help documentation as man_help, and use the -b parameter to filter all control characters. Use the following command in the terminal:

man man | col-b > man_help  

Note:Here, "|" is used to create a pipeline, converting the output of the man command into the input data for the col command.

Linux 命令大全Linux Command Reference

Other Extensions