Means of trimming files

Gerard Samuel fbsd-questions at trini0.org
Tue Jun 29 13:46:30 PDT 2004


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.


More information about the freebsd-questions mailing list