sed 分组替换

将文件以help开头的句子前加#

[root@localhost]# cat a.txt
help b help
help
1help
help2
help c help
[root@localhost]# sed "s/\(^help.*\)/#\1/g" a.txt
#help b help
#help
1help
#help2
#help c help

posted @ 2019-11-06 14:24  sunshine_5  阅读(2677)  评论(0编辑  收藏  举报