【发布时间】:2017-08-08 10:07:04
【问题描述】:
我需要一个小脚本来搜索日志文件中的字符串并计算行数。因为这可能需要一段时间,所以我还希望在控制台中显示“grep”的输出。我的想法是这样的:
grep -irl "System out of memory" | tee /tmp/checkoom.tmp
COUNT=(cat /tmp/checkoom.tmp |wc -l)
echo $COUNT logs found.
但它不起作用。我没有得到任何输出,tmp 文件已创建但似乎为空。
【问题讨论】: