You are here:
How to replace string patterns on multiple files using emacs?
How to replace string patterns on multiple files using emacs?
Submitted by Edgar Galvan on Thu, 2010-03-18 18:49.
Using emacs can be of great help to achieve this. Follow the following steps:
- Open emacs from the directory that you want to replace the string patterns
- Press C-x C-f (C = Control) (press enter)
- Select those files where you want to replace the strings by pressing 'm' (use 'u' to unmark them)
- Once all the files have been marked, press 'ESC' followed by 'x', then type 'dired-do-query-replace-regexp'.
- Now, enter the string you want to replace (press enter) and then enter the new string (press enter)
- Emacs will stop and show you whenever a match occurred. Press 'y' to replace it or 'n' to skip it
- To save the data, press 'ESC' followed by 'x'. Then type 'ibuffer' (press enter). Type '*u' to mark all the unsaved data. Finally, press 'S'
- To exit, press C-x C-c
- Edgar Galvan's blog
- Login to post comments



