【发布时间】:2017-08-11 20:37:18
【问题描述】:
我一直在尝试使用 sed 输入一个包含多个特殊字符的值。样本值为//*[@id='login_username']
如果我们使用这个值而不使用任何转义字符,命令将如下所示:
sed -i 's/Text to be replaced/new text and some xpath like //*[@id='login_username']/' target.txt
我尝试使用 \ 字符转义每个特殊字符,结果如下结构://\*\[@id='login_username'\]
还尝试用双引号将值括起来,但这也不起作用。我还能尝试什么?
【问题讨论】: