D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Help with sed

 

kevin wrote:

> ie I am having to hack out lines like 
> 
> $database="blablabla";
> $host="localhost";

> [ ... ]

> when it works ( I may have up to 10 different lines to remove) i want to
> put in a "include db.ini ;"  statement.

I'd consider Perl.

Something like (untested):

perl -pi.bak -e 'undef $/; $f = <>; $f =~ s/blah\nclah\nblah/include blah/s; print 
$f' *.php

... or something.

Steve

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html