help-emacs-windows
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [h-e-w] isearch-regexp-in-all-matching-files-in-tree?


From: Dr Francis J. Wright
Subject: Re: [h-e-w] isearch-regexp-in-all-matching-files-in-tree?
Date: Wed, 16 Oct 2002 14:37:48 +0100

From: "Thomas L Roche" <address@hidden>
To: <address@hidden>; <address@hidden>
Sent: Monday, October 14, 2002 7:18 PM
Subject: [h-e-w] isearch-regexp-in-all-matching-files-in-tree?


> Use case: I'm in a dired buffer in GNU Emacs 21.1.1 on w2k. I
> want to _interactively_ search for the string 'GenericAction'
> (and replace with 'ActionClass') in all files with names matching
> '*.java' anywhere in the directory tree below the current
> directory.
>
> How can I do this?

Here is my suggestion.

List all the files in the tree in the same dired buffer by using the ls
switch R (recursive), e.g. do C-u C-x d, add R to the string of switches and
then confirm the root directory of the tree.  (This should work either by
default in NTEmacs or if you are using a decent external ls program.)

>From the Regexp menu, select Mark... and enter an empty regexp (just hit
Return).  This will mark every file in the buffer.

>From the Regexp menu, select Rename...
At the Rename from (regexp): prompt type \(.*\)GenericAction\(.*\.java\)
At the Rename ... to: prompt type \1ActionClass\2

You should then be queried interactively for each renaming via the usual
query-replace dialogue.  I can't test the details of this suggestion, so I'd
be interested to know whether it works and does what you want.  But be
careful, because you can't automatically undo such actions.  I suggest you
test the technique first on a small junk directory created as a test case.
(There's no point trying to sue me, because I'm a British academic and so
have no money!)

Best of luck, Francis





reply via email to

[Prev in Thread] Current Thread [Next in Thread]