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
原文地址:https://www.cnblogs.com/liujiaxin2018/p/14984249.html