bash - 男人 grep | grep "color"没有给出结果

标签 bash unix grep command

当我尝试使用此命令在 grep 手册中搜索颜色选项时,怎么会出现这种情况

man grep | grep "color"

我没有得到结果,但是当我运行时

man grep

man 输出这个 [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'.

最佳答案

尝试通过 col -b 管道手册页,在 grep 之前清除任何特殊字符。

例如:

man grep | col -b | grep "color"

或者,指定 col -b 作为你的 man pager:

man -P "col -b" grep | grep "color"

您甚至可以在您的 shell 配置文件中设置 MANPAGER 以使其更持久。

export MANPAGER='col -b | less'

但是,这意味着您在查看手册页时会失去漂亮的颜色。

关于bash - 男人 grep | grep "color"没有给出结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12600533/

相关文章:

linux - 使用 Dockerfile ENTRYPOINT 找不到 exec

unix - GPG仅在内存中解密/加密字符串

bash - Unix - 根据列值随机选择行

regex - 我的正则表达式有什么问题?

linux - 如何使用 shell 从计算机注销?

regex - 如何使用 bash 脚本格式化这些数据

linux - $ 代表什么?

linux - 如何在 Linux/Unix 上递归复制以 "abc"开头的目录?

bash - 提取匹配 "foo"的文件的最后 10 行

regex - 需要与以下 json 匹配的正则表达式