From: Kev Jackson Date: 2005-10-03T12:30:45+09:00 Subject: Re: ruby gsub! problem > > The typical Ruby idiom for this is: > > File.foreach(filename) do |line| > line.chomp! > > # ... processing code goes here ... > end > I didn't ry it to be honest, the real problem was that the data (when exported by another tool), has (\n) line endings at arbitrary places (ie 3 in a typical 'line' of data). So I really wanted to strip them out before resplitting on the real line delimiter ';'. I actually worked it out, I was trying filename.to_s.gsub!(/\n/, ''), but although ruby won't complain about this, it won't operate on it, if instead I spli on my delimiter ';' and then do a line.gsub!(/\n/,'') everything works fine Thanks for the help Is the idiom above more for processing multiple files (for each file, for each line do some processing close) kind of thing? Kev