You'll probably want to use perl for that. As usual there's a ton of approaches to this. One way is to use grep to find files which you want to perform the replacement on and then pass the file list to perl to replace:
Code:
grep -rl 'some posix regex here' * | xargs perl -p -i -e 's/replacethis/withthis/'
and then if you want, you can use find to get a filelisting and pass them all through perl:
Code:
find . -type f -iname '*.pm' | xargs perl -p -i.bak -e 's/replacethis/withthis/'
Where 'find' will recursively list all .pm files in the current directory, and perl will perform the regex, making a backup (to filename.pm.bak) of all replaced files. Of course the "-iname '*.pm'" part is optional, just leave it out to do the replacement on all files. The .bak part of the -i in the perl arguments is also optional. Leave it out to not make any backups - just make sure your regex works
oops, fixed.
Adrian