And*_*Dev 2 unix bash grep command
为什么我尝试使用此命令搜索grep手册中的颜色选项
man grep | grep "color"
Run Code Online (Sandbox Code Playgroud)
我没有结果,但是当我跑步时
man grep
Run Code Online (Sandbox Code Playgroud)
男人输出这个[已编辑]
--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'.
Run Code Online (Sandbox Code Playgroud)
col -b在grepping之前尝试通过管道页面来清理任何特殊字符.
例如:
man grep | col -b | grep "color"
Run Code Online (Sandbox Code Playgroud)
或者,指定col -b为手动寻呼机:
man -P "col -b" grep | grep "color"
Run Code Online (Sandbox Code Playgroud)
您甚至可以在shell配置文件中设置MANPAGER,以使其更加永久.
export MANPAGER='col -b | less'
Run Code Online (Sandbox Code Playgroud)
但是,这意味着在查看手册页时您将失去漂亮的颜色.