我有一個像在一個文件中的行,並希望在它下面添加。 我一直試圖用命令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