我遵循这样的多个日志文件:
tail -f /var/log/apache2/tv7r9r3falz0_error.log protected/runtime/application.log
有没有办法为每个文件着色,这样我就不必依赖于查找标题:
==> protected/runtime/application.log <==
我知道
multitail
,但我想自由滚动。
最佳答案
这将根据输出来自哪个日志文件以两种不同颜色打印输出:
tail -f log1 log2 | awk $'/==> log1/{print "\033[0m\033[1;33;40m";} /==> log2/{print "\033[0m\033[1;35;40m";} 1'
Elliot Chance 更新:这就是我需要的开始,这是工作版本:
tail -f /var/log/apache2/tv7r9r3falz0_error.log protected/runtime/application.log | awk '/==> /{print "\033[0m\033[1;36;40m";} /==> p/{print "\033[0m\033[1;33;40m";} {print $0}'
关于bash - 用不同的颜色显示多个文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28618785/