From: Stefan Lang Date: 2005-10-13T03:48:34+09:00 Subject: Re: Removing blank lines 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.) [...] > Or you mean writing back the result to the file? In that case, I > guess you'll have to write it to another, temporal file, and then > move it to the original path. Without tempfile: ruby -e 'text = File.read "text"; open "text", "w" do |f| f << text.gsub(/\n{2,}/, "\n") end' Regards, Stefan