男人的grep | grep的"色"没有给出结果 [英] man grep | grep "color" gives no result
本文介绍了男人的grep | grep的"色"没有给出结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么当我尝试搜索的颜色选项的grep手动与此命令
的grep人| grep的色
我没有得到任何结果,但是当我运行
的grep人
男人输出这将帖子
--colour = [时,--color = [时]
标记存储在GREP_COLOR环境变量中的前pression匹配的文本。何时能'永远','永远'或'自动'的可能值。
解决方案
试图通过山坳-b
管道手册页grepping之前清理任何特殊字符。
例如:
的grep人|山坳-b | grep的色
另外,指定山坳-b
为你的男人,传呼机:
男人-P山坳-b的grep | grep的色
您甚至可以设置MANPAGER在你的shell配置文件,使这个更持久。
出口MANPAGER ='山口-b |减'
然而,这意味着,显示man手册页时,你会失去pretty颜色。
How come when I try to search the grep manual for the color option with this command
man grep | grep "color"
I get no result but when I run
man grep
man outputs this [EDITED]
--colour=[when, --color=[when]]
Mark up the matching text with the expression stored in GREP_COLOR environment variable. The possible values of when can be `never', `always' or `auto'.
解决方案
Try piping the man page through col -b
to clean up any special characters before grepping.
For example:
man grep | col -b | grep "color"
Alternatively, specify col -b
as your man pager:
man -P "col -b" grep | grep "color"
You can even set MANPAGER in your shell profile to make this more permanent.
export MANPAGER='col -b | less'
However, this means that you will lose the pretty colours when viewing man pages.
这篇关于男人的grep | grep的"色"没有给出结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文