Re: search and replace code in php or html files
On 2006-05-05 @ 18:48:36 (week 18) H.S. wrote:
> Casey T. Deccio wrote:
>
> >
> > find . -name "*.html" | xargs sed -i.bak -e
> > 's/string_to_replace/replacement/g'
> >
> > Does something like this work? If your match pattern spans more than
> > one line than you'll need a more complex script.
Might I suggest using multi-line mode in your regexp for those cases?
For perl the only thing you have to do is add the 'm' modifier to the
regexp. See http://search.cpan.org/~nwclark/perl-5.8.7/pod/perlreref.pod
for more info on that. I gather that sed and awk will have a similar
feature too.
Grx HdV
Reply to: