From: Emmanuel Oga Date: 2008-07-23T10:55:48+09:00 Subject: Re: Trying to search/replace in a text file. 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