sed 查找并替换为花括号 [英] sed find and replace with curly braces
本文介绍了sed 查找并替换为花括号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用此命令:
I am trying to use this command:
sed -i 's#\{test1\}#test2#' /example/myfile.txt
用 test2
替换 {test1}
的实例.
To replace instances of {test1}
with test2
.
我收到错误:
sed: -e expression #1, char 17: Invalid preceding regular expression
我是不是没有正确地转义花括号?
Am I not escaping the curly braces correctly?
推荐答案
sed -i 's#{test1}#test2#' /example/myfile.txt
您不需要转义 {}
这篇关于sed 查找并替换为花括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文