Christian Neukirchen wrote:

> Stefan Lang <langstefan / gmx.at> writes:
> 
>>similar:
>>
>>    ruby -e 'puts File.read("test").gsub(/\n{2,}/, "\n")'
> 
>       ruby -e 'print File.read("t").squeeze("\n")'
> 
> Know thy tools :-)

Yep!

   ruby -i.bak -ple 'next if $_==""' test

Inplace editing with backup file.

cheers

Simon