sed的两种添加多行文本方法

方法一:

[root@localhost ~]# cat a.sed
Zhang San
Li Si
[root@localhost ~]# cat test
What is your name
how are you
[root@localhost ~]# sed '$r a.sed' test
What is your name
how are you
Zhang San
Li Si

方法二:

[root@localhost ~]# cat b.sed 
$a\
Zhang San\
Li Si
[root@localhost ~]# cat test
What is your name
how are you
[root@localhost ~]# sed -f b.sed test 
What is your name
how are you
Zhang San
Li Si

你可能感兴趣的:(sed的两种添加多行文本方法)