我有一个像在一个文件中的行,并希望在它下面添加。 我一直试图用命令Sed命令错误
sed -e '/</session-config>/a\<security-constraint>\' -i filename
但它不工作。的错误是:
sed的:-e表达#1,炭43:无端接`s'的命令
例如inputfile中
<more></more>
<session-config>20</session-config>
<otherfields>10</otherfields>
后sed命令
<more></more>
<session-config>20</session-config>
<security-constraint>
<otherfields>10</otherfields>
请帮助。
谢谢。
posix版本需要'a'后面的新行,而不是GNU sed版本(但在这种情况下忽略'a'后面的''''a \ n'在附加行上产生'n'而没有空行之前),但我更喜欢你的版本,无处不在 – NeronLeVelu