On Sep 30, 2005, at 2:49 AM, Kev Jackson wrote:

> Another gsub/regex problem
>
> I've got a load of data with newlines (\n) scattered throughout, I  
> want to remove all the newlines from this file, before
>
> filename.each do |line| ... end

The typical Ruby idiom for this is:

File.foreach(filename) do |line|
     line.chomp!

     # ... processing code goes here ...
end

Is there some reason this doesn't work for you?

James Edward Gray II