Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.
This article has participated in the “Digitalstar Project” and won a creative gift package to challenge the creative incentive money.
Man save text
First, explain the method directly:
Save the MAN manual document in text format. The common methods are as follows:man command | col > file
或 man command | col -b > file
.
Such as:
Help manual for the top command:
Man top | col > top_help. TXT;
The mkdir command:
Man mkdir | col – b > mkdir -help. TXT.
Why col
Col is used to filter out reverse newlines, control characters, and more, making text easier to read and save.
But in practice, most save with man direct redirection and usually without garbled characters. Such as man command > file.
Treatment as a matter of habit or standard. Is usually a man command | col – b > file.
Col command
introduce
The col command in Linux is used to filter out reverse line feeds so that the output looks more in the correct order — only forward and semi-forward feeds, And replace whitespace characters with tabs whenever possible. This proved useful when working with nROFF and TBL outputs.
The COL utility reads and writes standard output from standard input.
col command in Linux system is used to filter out reverse line feeds such that the output looks much more in the correct order with only forward and half forward line feeds and replaces the whitespace characters with tabs wherever possible. This can be proven useful in the processing of the output of nroff and tbl.
The col utility simply reads from the standard input and writes to standard output.
Nroff and Troff are tools for formatting text, old and powerful. Both use TBL as a preprocessor when formatting tables.
The name RUNOFF comes from the phrase “to run off a document.” It means to finish a document, or to prepare to publish or present a document.
The name RUNOFF comes from the phrase “to run off a document,” meaning to finalize a document, or prepare it for publication or presentation.
- Nroff — “new runoff”/”newer Runoff”
- Troff — “typesetter roff.” “
- Groff — refers to the GNU Troff project
You are advised to refer to Linux Troff Command and Linux Nroff Command
Install when the col command does not exist
# RHEL
yum install noweb
#Ubuntu
apt-get install noweb
Copy the code
Syntax parameters
Col [-bfhpx][-l < buffer column number >]Copy the code
Parameters:
-b
Filter out all control characters, including RLF and HRLF.-f
Filter RLF characters, but allow HRLF characters to be rendered.-h
It is not allowed to display multiple Spaces instead of tabs-p
Force the unknown control sequence to remain unchanged. In general, COL filters out any control sequences from the input except those it identifies and interprets.-x
Replace the tabs character with multiple space characters.-l < number of buffer columns >
The preset memory buffer has 128 columns (the default) and you can specify the size of the buffer.
reference
Refer to col Command in Linux with Examples and rookie tutorials