From: Anurag Priyam Date: 2011-01-30T13:25:43+09:00 Subject: Re: gsub! on a txt file > The snag I'm encountering is when I have to make Ruby understand that it > has to consider the text inside a file! > > file = File.open("/R/testo.txt", "r") > > text = (file.each {|line| print line }).to_s > > text.to_s > text.gsub!(/o/,"*") > > That's what I've done, but it limits itself to print the text...! > > How can I do? text = File.read('/R/testo.txt') text.gsub!(/o/, "*") puts text -- Anurag Priyam http://about.me/yeban/