bash - ack(-grep) 有哪些颜色选项用于输出、日志等的着色?

标签 bash shell logging ack

在哪里可以找到所有颜色组合的列表或可用于 ack(-grep) 的列表?我发现通过 ack-grep 传递日志对于检测错误、警告或各种其他情况非常有帮助,尤其是在着色方面,但是我还没有找到可以使用哪些组合等的权威列表.

tail -f development.log \
| ack-grep --flush --passthru --color --color-match=yellow "^.*warning.*"

我见过一些选项,例如标准颜色:redblueyellowgreen,等等

而且我看到您可以使用 "white on_green"

还有什么?

最佳答案

ack 使用 Perl 的 Term::ANSIColor 模块,因此您可以使用以下方法检查可用的内容:

perldoc Term::ANSIColor

这是相关的摘录。

   The recognized normal foreground color attributes (colors 0 to 7) are:

     black  red  green  yellow  blue  magenta  cyan  white

   The corresponding bright foreground color attributes (colors 8 to 15)
   are:

     bright_black  bright_red      bright_green  bright_yellow
     bright_blue   bright_magenta  bright_cyan   bright_white

   The recognized normal background color attributes (colors 0 to 7) are:

     on_black  on_red      on_green  on_yellow
     on_blue   on_magenta  on_cyan   on_white

   The recognized bright background color attributes (colors 8 to 15) are:

     on_bright_black  on_bright_red      on_bright_green  on_bright_yellow
     on_bright_blue   on_bright_magenta  on_bright_cyan   on_bright_white

   For any of the above listed attributes, case is not significant.

很高兴看到您也使用 --passthru

我们欢迎您调用 ack-users mailing list

关于bash - ack(-grep) 有哪些颜色选项用于输出、日志等的着色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9625316/

相关文章:

regex - 使用正则表达式重命名文件?

linux - sed 从文件中注释行号 x 到 y

c# - 如何以编程方式移动 Windows 任务栏(需要两个)

postgresql - 使用没有密码的 psql 命令运行批处理文件

java - Log4j2 JSONLayout 时间戳模式

bash:分块处理文件列表

linux - bash 脚本中的 docker 日志不起作用

linux - 如何将匹配的文件移动到另一个目录?

python - 我的 python 脚本通过我的 IDE (PyCharm) 运行,但无法使用 Python shell 运行

python - 在 Python 中解析巨大的日志文件