Possible Duplicate:
Using Emacs to recursively find and replace in text files not already open
I am using emacs and want to replace a word (well, all functions called foo() to foobar()) for all occurrences in a directory of source files. What is the best way to do this?
Burton’s answer is as easy as it gets. Here’s one way to do it in Emacs:
M-x diredfill in the directory you want to work in* smarks all files in the directoryQruns query-replace-regex on all marked files. Fill in the search regex and the replace string.Type
!to replace all occurrences in each file. You will have to go back to save the changes though.