尝试将手册页连接到纯文本文件时出现重复字符
Repeating characters when attempting to concatenate man pages to plain text files
我尝试将一些手册页转换为纯文本文件。但是当我打开文件时,很多单词都有不必要的重复字符。
例如,执行 man awk > awk.txt
会更改 awk.txt 文件中的部分:
- NAME 到 NNAAMMEE
- 概要 至 SSYYNNOOPPSSISS
- 描述 到 DDEESSCCRRIIPPTTIIOONN
我认为这将是一项简单的任务。为什么会这样?
手册页包含格式化信息(例如,指示某些词是否应为粗体)。因此,在重定向文件中的输出时,某些字符可能会重复出现。
您可能想试试:
man awk | col -b > awk.txt
col 在做什么:
col — filter reverse line feeds from input
SYNOPSIS
col [-bfhpx] [-l num]
DESCRIPTION
The col utility filters out reverse (and half reverse) line feeds so that the output is in the correct order with only forward and half
forward line feeds, and
replaces white-space characters with tabs where possible. This can be useful in processing the output of nroff(1) and tbl(1).
The col utility reads from the standard input and writes to the standard output.
The options are as follows:
-b Do not output any backspaces, printing only the last character written to each column position.
我尝试将一些手册页转换为纯文本文件。但是当我打开文件时,很多单词都有不必要的重复字符。
例如,执行 man awk > awk.txt
会更改 awk.txt 文件中的部分:
- NAME 到 NNAAMMEE
- 概要 至 SSYYNNOOPPSSISS
- 描述 到 DDEESSCCRRIIPPTTIIOONN
我认为这将是一项简单的任务。为什么会这样?
手册页包含格式化信息(例如,指示某些词是否应为粗体)。因此,在重定向文件中的输出时,某些字符可能会重复出现。
您可能想试试:
man awk | col -b > awk.txt
col 在做什么:
col — filter reverse line feeds from input
SYNOPSIS
col [-bfhpx] [-l num]
DESCRIPTION
The col utility filters out reverse (and half reverse) line feeds so that the output is in the correct order with only forward and half forward line feeds, and replaces white-space characters with tabs where possible. This can be useful in processing the output of nroff(1) and tbl(1).
The col utility reads from the standard input and writes to the standard output.
The options are as follows:
-b Do not output any backspaces, printing only the last character written to each column position.