[oclug] Search & replace Q.
Jon Earle
je_oclug at kronos.honk.org
Wed Jul 14 16:25:30 EDT 2004
On Wed, 14 Jul 2004, Joe Burpee wrote:
> perl -i.bak -pe '/OBJECT\s*box\s*=\s*blahblah/../;/ and
> s/(STYLE\s*=\s*")thisstyle"/$1thatstyle"/' filename
>
> This assumes no extra `;' inside quotes, etc. Also it changes the file
> in-place, with backup in filename.bak.
>
> See `man perlop' for the `..' operator.
Thanks Joe, and Patrick. I actually ended up using the perl variant of
Joe's as I understand perl more than sed... guess what I need to learn
next. :) It worked like a charm!
Cheers!
Jon
--
Jon Earle
Software Developer / Network Manager
Specializing in Open Source Software Solutions
http://kronos.honk.org/~earlej/
More information about the OCLUG
mailing list