Pom*_*oma 7 10.04 command-line bash regex sed
我需要替换文件中的一些字符串(从命令行),但我不想使用,sed -i
因为我的字符串包含许多需要正确转义的有趣字符。有没有办法关闭正则表达式并替换普通字符串?
ste*_*ver 10
使用 perl 可能会更好 - 它支持通过\Q
(引用的句子)修饰符进行文字字符串匹配,例如
perl -pe 's/\Qstring/replacement/g'
Run Code Online (Sandbox Code Playgroud)
例如,请参阅boost.org 上的这篇文章Perl 正则表达式语法