我正在尝试使用shell脚本运行以下命令:
sed -i -e 's/<!-- XML Comment 1 -->/<!--XML Comment 2 -->/g; s/<!-- XML Comment 3 -->/<!--XML Comment 4 -->/g'
我得到以下错误:
sed: -e expression #1, char 9: unterminated address regex
当我试图逃离"<或"!",消息只是从"char9"变为"char10"。当我逃离这两个字符时,错误出现在字符11处。我还需要逃离其他角色吗?
不需要转义'
和/
。
sed -i -e 's/<!-- XML Comment 1 -->/<!--XML Comment 2 -->/g; s/<!-- XML Comment 3 -->/<!--XML Comment 4 -->/g' file.xml