Date: Wed, 30 Jun 2004 13:09:26 +1000 From: Gautam Gopalakrishnan <thatha@gmail.com> To: Bill Moran <wmoran@potentialtech.com> Cc: freebsd-questions@freebsd.org Subject: Re: Means of trimming files Message-ID: <a3ada2d104062920093e8e4744@mail.gmail.com> In-Reply-To: <20040629195025.549fe8f3.wmoran@potentialtech.com> References: <200406292005.i5TK5nZ18158@clunix.cl.msu.edu> <200406291621.22848.fbsd-questions@trini0.org> <20040629195025.549fe8f3.wmoran@potentialtech.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 29 Jun 2004 19:50:25 -0400, Bill Moran <wmoran@potentialtech.com> wrote: > > Gerard Samuel <fbsd-questions@trini0.org> wrote: > > > find ./ -name '*.php' -exec php -r '$f = file_get_contents("{}"); $h = > > fopen("{}", "wb"); fwrite($h, trim($f)); fclose($h);' \; > > > > It did the job perfectly. $ perl -0 -pi -e 's/\n+$//s' *.php will edit each .php file and replace it too. If you want a backup, then $ perl -0 -p -i.bak -e 's/\n+$//s' *.php Cheers Gautam
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a3ada2d104062920093e8e4744>