One of the great things about linux (& unix) is that their are often several diffrent ways to apprach just about any problem that you are faces with. This is one of those cases. For basic substitution using sed is one of my favorite choices. For instance if I want to replace 'NOT' with 'not' in a file called data I could do something like....
sed 's/NOT/not/' data > new_data; cat new_data > data; rm new_data
as you can see I dump the info out to a temporary holding file called new_data and when it is complete I overwrite the original with the modified version.
Other solutions presented here on linuxquestions include....
http://www.linuxquestions.org/questi...?postid=932751
http://www.linuxquestions.org/questi...hreadid=137374
If you want to do something a bit more complex it might be worth your time to brush up on your perl, which has some very good tools for editing text.
I hope that this helps.