Use the col command of linux to filter control characters
Do not know how to use linux's col command to filter control characters? In fact, it is not difficult to solve this problem. Let the editor take you to learn how to solve it. I hope you will gain a lot after reading this article.
Function introduction:
The full name of the col command is "colation" in English, and its Chinese definition is "filter". This command is a standard input text filter that reads text from the annotation input device and displays the content to the annotation output device. In many UNIX documentation, there are RLF control characters. When we use the shell special characters ">" and "> >" to output the contents of the description file into a plain text file, the control characters will become garbled, and the col instruction can effectively filter out these control characters.
Syntax format: col [parameters]
Common parameters:
-b filters out all control characters, including RLF and HRLF-f to filter RLF characters, but allows HRLF characters to be rendered-x represents tabbed characters as multiple space characters-l preset memory buffer has 128 columns, you can specify the size of the buffer
Reference example
Save the help document for the man command as man_help, and use the-b parameter to filter all control characters:
[root@linuxcool ~] # man man | col-b > man_help
Dump the description file of man to a plain text file and filter out all control characters:
[root@linuxcool ~] # man col | col-b > file
Use cat-A to display all the special keys, and finally turn it to blank with col:
[root@linuxcool] # cat-A / etc/man.config
Transfer the man page of col to plain text of / root/col.man:
[root@linuxcool ~] # man col | col-b > / root/col.man Thank you for reading this article carefully. I hope it is helpful for everyone to share the col command of linux to filter the content of control characters. At the same time, I also hope you can support us, pay attention to the industry information channel, and find out if you encounter problems. Detailed solutions are waiting for you to learn!