将 Sed 与 grep 一起用于日志文件
using Sed with grep for the log file
我试图让 php 错误日志看起来很好
每当我做 error_log($ex->getTraceAsString()) 但它打印 \n 所以我想出了可能性,结果证明我应该从终端本身做那件事
我也是
tail -f /var/log/apache2/error.log | sed 's/\n/\n/g'
但以前我曾经做过日志
tail -f /var/log/apache2/error.log | grep production
对于包含关键字生产的日志
但是我想要他们两个我该怎么办?这样我的两个标准都有效
我试过了
tail -f /var/log/apache2/error.log | grep production | sed 's/\n/\n/g'
tail -f /var/log/apache2/error.log | sed 's/\n/\n/g' | grep production
(tail -f /var/log/apache2/error.log | grep production) | sed 's/\n/\n/g'
(tail -f /var/log/apache2/error.log | sed 's/\n/\n/g') | grep production
但其中 none 有效。我该怎么办?
将搜索字符串添加到带有 /..../ 的 sed 语句中,因此:
tail -f /var/log/apache2/error.log | sed -n '/production/s/\n/\n/gp'
我试图让 php 错误日志看起来很好 每当我做 error_log($ex->getTraceAsString()) 但它打印 \n 所以我想出了可能性,结果证明我应该从终端本身做那件事
我也是
tail -f /var/log/apache2/error.log | sed 's/\n/\n/g'
但以前我曾经做过日志
tail -f /var/log/apache2/error.log | grep production
对于包含关键字生产的日志
但是我想要他们两个我该怎么办?这样我的两个标准都有效
我试过了
tail -f /var/log/apache2/error.log | grep production | sed 's/\n/\n/g'
tail -f /var/log/apache2/error.log | sed 's/\n/\n/g' | grep production
(tail -f /var/log/apache2/error.log | grep production) | sed 's/\n/\n/g'
(tail -f /var/log/apache2/error.log | sed 's/\n/\n/g') | grep production
但其中 none 有效。我该怎么办?
将搜索字符串添加到带有 /..../ 的 sed 语句中,因此:
tail -f /var/log/apache2/error.log | sed -n '/production/s/\n/\n/gp'