Word replacement from the file

hello,

I need little help from you that i want to replace word/s from a .rb and
.txt file. I am using the ‘gsub’ function for replacing the word from
the string but i am not able to replace word/s from a file (.rb and
.txt).

I will be very kind and thnkful to you if you could resolve my problem,

You can use ruby’s IO library to read the contents of a file into a
string, or cycle through by lines, or what have you. See:
http://www.ruby-doc.org/core/classes/IO.html

HTH,

-Roy