From: Jarmo Pertman Date: 2009-01-14T06:40:13+09:00 Subject: Re: Reading RTF + Text File and pattern matching Or, in little shorter way: data = File.readlines("test1.txt") #read file into array data.map! {|line| line.gsub(/world/, "ruby")} #invoke on each line gsub File.open("test2.txt", "a") {|f| f.puts data} #output data to other file Although I don't understand, why would you want to append instead of write? Sukhwinder Tambar wrote: > Reading RTF and Text File in Ruby and Pattern Matching/searching from > file and replacing with your data.... -- Posted via http://www.ruby-forum.com/.