谁能告诉我下面的 linux 命令的作用:
tail -5 test.log | grep 'Start Calculate' | awk '{print $1}'
我知道tail -5 test.log | grep 'StartCalculate'
在 test.log 中查找包含 'StartCalculate' 的最后 5 行。但我不明白 awk 是做什么的?
最佳答案
tail -5 test.log
获取 test.log
文件的最后 5 行
然后
grep 'StartCalculate'
过滤器仅保留包含“StartCalculate”的行
然后
awk '{print $1}'
获取每行的第一列(使用 空格
作为列之间的分隔符)
关于Linux awk 命令与管道,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37879306/