linux 系统中 sed -n选项控制行的下移
1、
[root@centos79 test]# cat a.txt 1 2 3 4 5 6 7 8 9 10 [root@centos79 test]# sed '/2/ s/^/xxx/' a.txt 1 xxx2 3 4 5 6 7 8 9 10 [root@centos79 test]# sed '/2/ {n; s/^/xxx/}' a.txt 1 2 xxx3 4 5 6 7 8 9 10
1、
[root@centos79 test]# cat a.txt 1 2 3 4 5 6 7 8 9 10 [root@centos79 test]# sed '/2/ s/^/xxx/' a.txt 1 xxx2 3 4 5 6 7 8 9 10 [root@centos79 test]# sed '/2/ {n; s/^/xxx/}' a.txt 1 2 xxx3 4 5 6 7 8 9 10