ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

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

2019-07-15 10:51:03  阅读:144  来源: 互联网

标签:bash linux man


我将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 information.  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 information.

     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中.

标签:bash,linux,man
来源: https://codeday.me/bug/20190715/1466830.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有