From: 7stud -- Date: 2007-09-19T05:53:50+09:00 Subject: Re: removing newline from eachline in file Chuck Dawit wrote: > I'm reading a file line by line and trying to remove the newline at the > end of each line so that I can rebuild the url with the "www" and the > ".net" at the beginning and end. Does anyone know how I can remove the > newline char at the end of each line? See String#chomp: require "open-uri" File.open("aaa.txt", "w") do |file| file.print("hello\n", "world\n", "goodbye\n") end File.open("aaa.txt") do |file| file.each do |line| print line.chomp end puts end --output:-- helloworldgoodbye -- Posted via http://www.ruby-forum.com/.