Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用 grep 命令后,我会给你一个小例子
grep 测试
测试这是第一行:1
测试这是第二行:2
测试这是第三行:3
测试这是第四行:4
grep命令执行后如何过滤最后一行
最后我需要结果 4
如果我没有误会你:
$grep test | tail -1 >test this is fourth line : 4 $grep test | tail -1 | awk '{print $7}' >4
$7是 中的“第七列” awk。
$7
awk