[thelist] OT? Making same modification to large number of files

Vijay Immanuel codelad at gmail.com
Fri Feb 9 23:57:54 CST 2007

On 2/9/07, Barney Carroll <barney at textmatters.com> wrote:
> I've been given the odious task of making amendments to a legacy site.
> It was made in the good old days of 'individually hard code 300 pages'.
> I need to change a small amount of text in the footer that appears on
> every single page.
> Anybody know an easy method (maybe unix command?) to achieve this
> conceptually simple but practically odious task?

Assuming you have Emacs available on your *nix terminal, the
keybinding Q (assigned by default to run
`dired-do-query-replace-regexp`) on Dired mode should do the trick.

If you are unfamiliar with Emacs, the steps to follow would be:

1. In Emacs, invoke Dired mode  (keys 'C-x d') on the directory your
files reside in.

2. "Mark" the individual files you want to alter (key 'm'). Use keys
'n' and 'p' to move vertically, and 'u' to "unmark" files.

3. Call the dired-do-query-replace-regexp command (key 'Q'), and enter
the regexp you want to search and replace with.


More information about the thelist mailing list