From: Thomas Adam Date: 2006-10-09T03:45:12+09:00 Subject: Re: how to concatenate all the lines into one string On Mon, Oct 09, 2006 at 03:36:43AM +0900, Li Chen wrote: > Hi all, > I am new to Ruby. I just wonder how I can concatenate all the lines from > one file and let them become one string. How about: a=File.open("/home/n6tadam/.xsession").read.gsub!('\n', ' ') I've substituted the newlines for spaces -- but you can do whatever you want with it. -- Thomas Adam -- "If I were a witch's hat, sitting on her head like a paraffin stove, I'd fly away and be a bat." -- Incredible String Band.