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

 

posted @ 2021-07-07 23:57  小鲨鱼2018  阅读(216)  评论(0编辑  收藏  举报