sed 搜索并替换


find . -type f -exec sed -i "s/std=c++11/std=c++14/g" {} \;

搜索当前目录下的文件,把std=c++11替换成std=c++14,注意{}\之间有个空格。

全词替换

$ echo "bar embarassment" | sed "s/\bbar\b/no bar/g"
no bar embarassment

\b in regular expressions match word boundaries (i.e. the location between the first word character and non-word character):


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM