From: Christian Neukirchen Date: 2005-10-13T04:14:32+09:00 Subject: Re: Removing blank lines Stefan Lang writes: > On Wednesday 12 October 2005 20:32, Esteban Manchado Vel�zquez wrote: >> Hello Basi, >> >> On Thu, Oct 13, 2005 at 03:26:52AM +0900, basi wrote: >> > Hello, >> > How does one delete blank lines from a text file? (I did try a >> > number of things, but, I can't get any to work.) > >> zoso@velutha:~/tmp$ ruby -e 'puts File.readlines("test").find_all >> {|line| line !~ /^$/}' > > similar: > > ruby -e 'puts File.read("test").gsub(/\n{2,}/, "\n")' ruby -e 'print File.read("t").squeeze("\n")' Know thy tools :-) > Stefan -- Christian Neukirchen http://chneukirchen.org