is it possible, inside a bash script to do the following?
Sure, but easier (tool for the purpose, efficient, generic) would be to use
rpl since it fully replaces your script and is faster.
how?
Since you didn't explicitly ask us to write the script for you: you'll need a "while loop", find, cat, sed and mv. Use cat' to get the change text into a variable, 'find' to find the filenames by extension, pipe the output so it can be used in the "while loop" (and maybe do some tests like the file exists and is not a symlink, access permissions), ''sed' to rewrite the text to a tempfile and 'mv' to move the tempfile back to the filename.
Code:
function help() { echo "Bash scripting guides:
http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
http://www.tldp.org/LDP/Bash-Beginners-Guide/html/index.html
http://www.tldp.org/LDP/abs/html/"; }
BTW, threads like these are usually found in the "Programming" forum. I'll move it there since this ain't distro-specific.