微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

linux – 将手册页输出重定向到文件会产生双字母

我将man djpeg的输出重定向一个文本文件中,以便在我学习使用它时可以引用它.我的指示是男人djpeg> TextFile.txt的.但是,输出看起来像这样:

LS(1)                     BSD General Commands Manual                    LS(1)

NNAAMMEE
     llss -- list directory contents

SSYYNNOOPPSSIISS
     llss [--AABBCCFFGGHHLLOOPPRRSSTTUUWW@@aabbccddeeffgghhiikkllmmnnooppqqrRSSttuuwwxx11] [_f_i_l_e _._._.]

DDEESSCCRRIIPPTTIIOONN
     For each operand that names a _f_i_l_e of a type other than directory, llss
     displays its name as well as any requested, associated @R_45_4045@ion.  For
     each operand that names a _f_i_l_e of type directory, llss displays the names
     of files contained within that directory, as well as any requested, asso-
     ciated @R_45_4045@ion.

     If no operands are given, the contents of the current directory are dis-
     played.  If more than one operand is given, non-directory operands are
     displayed first; directory and non-directory operands are sorted sepa-
     rately and in lexicographical order.

     The following options are available:

     --@@      display extended attribute keys and sizes in long (--ll) output.

     --11      (The numeric digit ``one''.)  Force output to be one entry per
             line.  This is the default when output is not to a terminal.

     --AA      List all entries except for _. and _._..  Always set for the super-
             user.

     --aa      Include directory entries whose names begin with a dot (_.).

     --BB      Force printing of non-printable characters (as defined by
             ctype(3) and current locale settings) in file names as \_x_x_x,
             where _x_x_x is the numeric value of the character in octal.

     --bb      As --BB, but use C escape codes whenever possible.

[...continues]

还有更多,但你明白了.为什么要重复一些角色呢?另外,如果某些功能执行两次或缓存刷新错误,为什么不重复所有这些?

解决方法:

‘man’程序最初设计用于在电视类型上打印其输出,并使用过度打印来产生大胆的字符和下划线效果.您实际看到的是包含X ^ HX形式字符串的文件效果,其中^ H是退格字符.你也有像_ ^ HX这样的字符串用于下划线(因此是_f_i_l_e).

这些可以使用像vi这样的文本编辑器轻松剥离,这将显示退格.

:%s/_^H//g

删除下划线,和

:%s/.^H.//g

粗体(上面的^ H是ctrl-H.你必须使用ctrl-V ctrl-H将这些输入到vi中.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐