* RE: [h-e-w] Re: isearch-regexp-in-all-matching-files-in-tree?
@ 2002-10-15 8:21 Dalton, Barnaby
0 siblings, 0 replies; 4+ messages in thread
From: Dalton, Barnaby @ 2002-10-15 8:21 UTC (permalink / raw)
Cc: help-gnu-emacs, help-emacs-windows
To rename files I use a perl script 'rename' from the perl cookbook
http://www.linuxchix.org/pipermail/techtalk/2001-October/012104.html
To replace stuff in files have a look at
http://www.emacswiki.org/cgi-bin/wiki.pl?SearchAndReplaceAcrossMultipleFiles
. I use grep-x which does what you asked with the grep buffer but there are
other options documented here as well.
Barney
> -----Original Message-----
> From: Thomas L Roche [mailto:tlroche@us.ibm.com]
> Sent: 14 October 2002 7:56 PM
> To: David Forrest
> Cc: help-gnu-emacs@gnu.org; help-emacs-windows@gnu.org
> Subject: [h-e-w] Re: isearch-regexp-in-all-matching-files-in-tree?
>
>
> On Mon, 14 Oct 2002, Tom Roche wrote:
> >> 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.
>
> Dave Forrest 10/14/2002 02:37 PM
> > Would the Operate/Query replace in marked files Q
> > or
> > dired-do-query-replace do what you need?
>
> No, because it requires marking the matching files first, but if
> there's a way to do that, I could (manually) chain the two
> operations.
>
> Alternatively, is there a way that I could query-replace-regexp
> on a grep-mode buffer, instead of a dired buffer? I'd be happy if
> I could
>
> M-x grep-find RET
>
> find . -type f -print0 -name '*.java'| xargs -0 -e grep -n -e
> 'GenericAction' | grep -v 'EGLGenericAction' | grep -v
> 'GenericActionModel' | grep -v 'GenericActionCodeGenContrib' RET
>
> Q RET
>
> GenericAction RET
>
> ActionClass RET
>
>
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
postmaster@radioscape.com.
This footnote also confirms that this email message has been scanned
for the presence of computer viruses known at the time of sending.
www.radioscape.com
**********************************************************************
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [h-e-w] Re: isearch-regexp-in-all-matching-files-in-tree?
@ 2002-10-15 16:54 Thomas L Roche
0 siblings, 0 replies; 4+ messages in thread
From: Thomas L Roche @ 2002-10-15 16:54 UTC (permalink / raw)
Cc: help-emacs-windows, help-gnu-emacs
Thomas L Roche Mon, 14 Oct 2002 14:18:59 -0400
>>>> 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.
Dave Forrest 10/14/2002 02:37 PM
>>> Would the Operate/Query replace in marked files Q or
>>> dired-do-query-replace do what you need?
I replied
>> No, because it requires marking the matching files first, but if
>> there's a way to do that, I could (manually) chain the two
>> operations.
Bill Pringlemeir 10/15/2002 11:37 AM
> C-h f -> "dired-mark-files-regexp"
> dired-mark-files-regexp is an interactive compiled Lisp function
> in `dired'. (dired-mark-files-regexp REGEXP &optional
> MARKER-CHAR)
> Mark all files matching REGEXP for use in later commands. A
> prefix argument means to unmark them instead. `.' and `..' are
> never marked.
> REGEXP is an Emacs regexp, not a shell wildcard. Thus, use `\.o$'
> for object files--just `.o' will mark more than you might think.
Again, that only handles part of the use case, which I see having 3
main parts:
0 interactive search/replace for a string within
1 files with names matching another string
2 anywhere in the directory tree below the current directory
So dired-mark-files-regexp allows me to mark the files by name (1), and
dired-do-query-replace-regexp does the interactive search/replace. But
only find-name-dired (or similar) seems to get me the files desired in
the entire directory tree.
However that I still need to dired-mark-files-regexp, with '.*', in
order to mark all the files returned by find-name-dired! Is there a
way around that?
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [h-e-w] Re: isearch-regexp-in-all-matching-files-in-tree?
@ 2002-10-15 17:34 Thomas L Roche
0 siblings, 0 replies; 4+ messages in thread
From: Thomas L Roche @ 2002-10-15 17:34 UTC (permalink / raw)
Cc: help-emacs-windows, help-gnu-emacs
"Dalton, Barnaby" <Barnaby.Dalton@radioscape.com> 10/15/2002 04:21 AM
> To replace stuff in files have a look at
>
http://www.emacswiki.org/cgi-bin/wiki.pl?SearchAndReplaceAcrossMultipleFiles
> . I use grep-x which does what you asked with the grep buffer but
> there are other options documented here as well.
Thanks: I documented the find-name-dired/dired-mark-files-regexp
combination there.
^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <mailman.1034700929.15144.help-gnu-emacs@gnu.org>]
* Re: [h-e-w] Re: isearch-regexp-in-all-matching-files-in-tree?
[not found] <mailman.1034700929.15144.help-gnu-emacs@gnu.org>
@ 2002-10-15 18:28 ` Kevin Rodgers
0 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2002-10-15 18:28 UTC (permalink / raw)
Thomas L Roche wrote:
> So dired-mark-files-regexp allows me to mark the files by name (1), and
> dired-do-query-replace-regexp does the interactive search/replace. But
> only find-name-dired (or similar) seems to get me the files desired in
> the entire directory tree.
Right.
> However that I still need to dired-mark-files-regexp, with '.*', in
> order to mark all the files returned by find-name-dired! Is there a
> way around that?
Yes. As I suggested earlier:
C-x h ; mark-whole-buffer
M-x dired-mark-files-in-region RET
Oops, here's a customization that requires:
(defadvice dired-mark-files-in-region (before interactive activate)
(interactive "r"))
You could even bind dired-mark-files-in-region to a key in dired-mode-map,
perhaps ". h".
--
<a href="mailto:<kevinr@ihs.com>">Kevin Rodgers</a>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-10-15 18:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-15 8:21 [h-e-w] Re: isearch-regexp-in-all-matching-files-in-tree? Dalton, Barnaby
-- strict thread matches above, loose matches on Subject: below --
2002-10-15 16:54 Thomas L Roche
2002-10-15 17:34 Thomas L Roche
[not found] <mailman.1034700929.15144.help-gnu-emacs@gnu.org>
2002-10-15 18:28 ` Kevin Rodgers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).