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}
相关文章
相关标签/搜索