sed 命令,打印出匹配行的下N行

測試文件 test.loghtml [root@localhost aaa]# cat test.log a 1 11 aa 2 22 b 3 33 a 4 44   匹配出以a開頭並以a結尾的後1行:java sed -n '/^a$/,+1p' test.log   輸出結果:測試 a 1 a 4   打印出符合開頭是a的記錄的下一行code sed -n '/a/ {n;p}
相關文章
相關標籤/搜索