Singeo wrote: > Hi, I'm pretty new to Ruby. I've got a text file where I need to > remove some new line characters. I've tried everything I can think of > to do this with no success, including: > > line.gsub!("/r","") > line.gsub!("/n","") > line=line.chomp > > I can't seem to get the new line character to be recognised and dealt > with. Any advice appreciated. > > Thanks > > > It looks like you should be using backslashes. If you want to match both newlines and carriage returns, you can use: line.gsub!(/[\n\r]/, "") -Dan