tags:

views:

44

answers:

2

Hello, I have trouble using sed. I need to replace some lines in very 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.

A: 

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

replace "string 1" "string 2" -- *.html
kibitzer
Thanks. Next time I search repositories before I ask a question.
Robin Hood
Note that it is a part of mysql client, not of coreutils or separate package.
wRAR
A: 

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' "{}" +;
ghostdog74