开发者

sed replacement does not work

开发者 https://www.devze.com 2022-12-25 17:02 出处:网络
I have trouble using sed. I need to replace some lines in ve开发者_C百科ry deprecated HTML sites which consist of many files.

I have trouble using sed. I need to replace some lines in ve开发者_C百科ry deprecated HTML sites which consist of many files. My script does not work and I do not why. When I tried to find exact pattern with Netbeas it worked.

find . -type f -name "*.htm?" -exec sed -i -r 's/ing\. Šuhajda Dušan\, Mírová 767\, 518 01 Dobruška\, \+420 737 980 333\,/REPLACEMENT/g' {} \;

Where is the mistake? Is there an alternative to replace text without searching regular expression but plain text? Thanks for any respond.


yes there is an easy command line tool called replace, syntax is like:

replace "string 1" "string 2" -- *.html


there is no need to escape comma since it not special.

find . -type f -iname "*.htm?" -exec sed -i.bak -r 's/ing\. Šuhajda Dušan, Mírová 767, 518 01 Dobruška, \+420 737 980 333,/REPLACEMENT/g' "{}" +;
0

精彩评论

暂无评论...
验证码 换一张
取 消