Mass find/replace...

Mel fbsd.questions at
Fri Dec 5 02:31:50 PST 2008

On Friday 05 December 2008 11:19:09 Marc Coyles wrote:
> > All done n' dusted now - thanks very much for everyone's input...!
> > Have noted everything down in the back of my copy of "Absolute
> > FreeBSD 2nd Edition" (which has inherited quite a few additional
> > pages since I bought it).
> >
> > Now that that's done, I can start to wander thru logs and find
> > who/how...
> >
> > Cheers!
> > Marc
> Arse - I spoke too soon.
> Anyone know any perl to remove blank lines???!
> It's left a blank line at top of each PHP file that it performed the action
> on, which has broken things a touch...

's/^(.*?)\r?\n\r?\n/$1\n/s' should only replace the first empty line it finds 
in a file and accounts for windows line endings.

Try it out on one file first:
perl -pi.bak 's/^(.*?)\r?\n\r?\n/$1\n/s' filename.php


Problem with today's modular software: they start with the modules
    and never get to the software part.

More information about the freebsd-questions mailing list