unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* isearch-regexp-in-all-matching-files-in-tree?
@ 2002-10-14 18:18 Thomas L Roche
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas L Roche @ 2002-10-14 18:18 UTC (permalink / raw)


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?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: isearch-regexp-in-all-matching-files-in-tree?
@ 2002-10-14 18:55 Thomas L Roche
  2002-10-15 15:37 ` isearch-regexp-in-all-matching-files-in-tree? Bill Pringlemeir
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas L Roche @ 2002-10-14 18:55 UTC (permalink / raw)
  Cc: help-gnu-emacs, help-emacs-windows

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: isearch-regexp-in-all-matching-files-in-tree?
       [not found] <mailman.1034621906.27584.help-gnu-emacs@gnu.org>
@ 2002-10-14 22:50 ` Kevin Rodgers
  0 siblings, 0 replies; 5+ messages in thread
From: Kevin Rodgers @ 2002-10-14 22:50 UTC (permalink / raw)


Thomas L Roche wrote:

> 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.


How about

M-x find-dired RET RET -type f -name "*.java"
C-x h
M-x dired-mark-files-in-region
Q GenericAction RET ActionClass RET

-- 
<a href="mailto:&lt;kevinr&#64;ihs.com&gt;">Kevin Rodgers</a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: isearch-regexp-in-all-matching-files-in-tree?
  2002-10-14 18:55 isearch-regexp-in-all-matching-files-in-tree? Thomas L Roche
@ 2002-10-15 15:37 ` Bill Pringlemeir
  0 siblings, 0 replies; 5+ messages in thread
From: Bill Pringlemeir @ 2002-10-15 15:37 UTC (permalink / raw)
  Cc: David Forrest, help-gnu-emacs, help-emacs-windows


>> 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?

 Thomas> No, because it requires marking the matching files first, but
 Thomas> if there's a way to do that, I could (manually) chain the two
 Thomas> operations.

C-h f -> "dired-mark-files-regex"

   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.

Emacs knows.

Bill Pringlemeir.







^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: isearch-regexp-in-all-matching-files-in-tree?
       [not found] <44364250@toto.iv>
@ 2002-10-15 19:14 ` Robert Mecklenburg
  0 siblings, 0 replies; 5+ messages in thread
From: Robert Mecklenburg @ 2002-10-15 19:14 UTC (permalink / raw)
  Cc: help-gnu-emacs, help-emacs-windows

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

M-x find-dired <ret>			# Invoke find-dired
.					# on the current directory
-name '*.java'				# insert the *.java name pattern
-exec grep -q GenericAction {} \;	# edit the grep command

When the find command finishes mark all files as in any dired buffer.

Finally, use A (dired-do-search) to search them interactively.

Hope this helps,
-- 
Robert





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-10-15 19:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-14 18:55 isearch-regexp-in-all-matching-files-in-tree? Thomas L Roche
2002-10-15 15:37 ` isearch-regexp-in-all-matching-files-in-tree? Bill Pringlemeir
     [not found] <44364250@toto.iv>
2002-10-15 19:14 ` isearch-regexp-in-all-matching-files-in-tree? Robert Mecklenburg
     [not found] <mailman.1034621906.27584.help-gnu-emacs@gnu.org>
2002-10-14 22:50 ` isearch-regexp-in-all-matching-files-in-tree? Kevin Rodgers
  -- strict thread matches above, loose matches on Subject: below --
2002-10-14 18:18 isearch-regexp-in-all-matching-files-in-tree? Thomas L Roche

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).