Back to main index

Emacs find-and-replace

Using emacs to recursively find-and-replace in text files not already open.

M-x find-name-dired: you will be prompted for a root directory and a filename pattern.
Press   t     to "toggle mark" for all files found.
Press   Q     for "Query-Replace in Files...": you will be prompted for query/substitution regexps.
Proceed as with query-replace-regexp: SPACE to replace and move to next match, n to skip a match, etc.
C-x C-s :    Save the current buffer in its visited file on disk (save-buffer).
C-x s   :    Save any or all buffers in their visited files (save-some-buffers).

More about here: saving files


Back to main index