shell代码指定行加代码

shell脚本就是我想用代码给一个配置文件制定的行数后面加一些东西
网上找的sed都是新写一行,但是我是要加在这行后面,有没有懂得朋友帮下忙

望采纳:
你可以使用“取代”的方法。在原来的内容上加上你想要的内容,全部取代。
比如源文件内容为:
hello world,hello hani.
hello world,hello hani.
hani is a good man,hani is handsome.
this is the test script of sed test.

命令行:sed ‘3c you are beautiful’ test [3c 取代指定行]
hello world,hello hani.
hello world,hello hani.
you are beautiful
this is the test script of sed test.

楼上答主方案可行, 但是优解方式则是

sed -i '3a 你要加入的内容'

3a指的是在第3行前面插入, 同样的还有i,3i则表示在第3行后面插入内容。如解决,请采纳!