Simon Kr÷šer wrote:
> 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.

Without inplace editing

ruby -pne 'next if /^\s*$/' test
ruby -ne 'puts $_ unless /^\s*$/' test

Kind regards

    robert