Means of trimming files

Bill Moran wmoran at potentialtech.com
Tue Jun 29 16:50:27 PDT 2004


Gerard Samuel <fbsd-questions at trini0.org> wrote:

> On Tuesday 29 June 2004 04:21 pm, Gerard Samuel wrote:
> > So Ill start using truncate() for now, and start investigating perl.
> > Thanks....
> > 
> 
> As I was writing the previous email, I thought about combining find with php's 
> cli interface and came up with this "dirty" command (all in one line) ->
> 
> find ./ -name '*.php' -exec php -r '$f = file_get_contents("{}"); $h = 
> fopen("{}", "wb"); fwrite($h, trim($f)); fclose($h);' \;
> 
> It did the job perfectly.

Now _that's_ using the tools ... and the tools you know to boot!

-- 
Bill Moran
Potential Technologies
http://www.potentialtech.com


More information about the freebsd-questions mailing list