Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Use the col command of linux to filter control characters

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report