linux中输出匹配行及其后的若干行
1、
[root@rhel7pc1 test]# ls a.txt [root@rhel7pc1 test]# cat a.txt 1 k d f 2 x c g 3 z c b 4 e w e 5 z c x 6 e d g 7 i j e [root@rhel7pc1 test]# grep -A 1 -w "x" a.txt 2 x c g 3 z c b -- 5 z c x 6 e d g [root@rhel7pc1 test]# sed -n '/x/, +1p' a.txt 2 x c g 3 z c b 5 z c x 6 e d g

浙公网安备 33010602011771号