From: rumpy@... Date: 2008-07-23T14:00:47+09:00 Subject: Re: Trying to search/replace in a text file. Emmanuel, thank you very much for sorting me out. I can see I was close but very confused on the write step. Quoting Emmanuel Oga : > Documentation : http://www.ruby-doc.org/core-1.8.6/classes/IO.html > > contents = File.read("filename") #read > contents.gsub!("what you look for", "the substitutive") # modify > File.open("filename", "rw") { |file| file << contents } #write > > Warning: File.read will bring the whole file to memory. > -- > Emmanuel Oga > ELC Technologies (TM) > 1921 State Street > Santa Barbara, CA 93101 > eoga@elctech.com > > (866)863-7365 Tel > (866)893-1902 Fax > > +44 (0) 20 7504 1346 Tel - London Office > +44 (0) 20 7504 1347 Fax - London Office > > http://www.elctech.com > >