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

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

[h-e-w] find-grep-dired


From: Richard M. Heiberger
Subject: [h-e-w] find-grep-dired
Date: Mon, 7 Jan 2002 14:23:50 -0500 (EST)

It works with no changes exactly as it did with 20.7 and/or cygwin 20.
I normally use find-dired rather than find-grep-dired as it gives
me more control, for example
M-x find-dired
pronpt for directory
prompt for find argument (with previous use proposed)

I often do something on the order of
-name \*.el -exec grep -i shell {} \;

or 
-name \*.el -exec grep -i c\[on\]\*tr\[o\]*l {} \; 

The last line picks up all occurrences of "ctrl" and "control"

The tricks are two:
a. special characters need to be escaped with "\"
b. any expression that starts with "-exec" needs to be closed
with "{} \;"
The {} says use the filename you just found.
The "\;" closes the "-exec", and you could put more find expressions
after it if you want to.

The reason I prefer find-dired is that it actually displays the lines
that it finds as well as the file in which they occur.

The next thing I do in the *Find* directory is do a search on the regular
expression.  emacs 21 highlights all occurences in the buffer of the search
string so it is much easier to read the *Find* buffer.  The pace the cursor
on a filename and press enter to bring up the file itself.

The search-forward-regexp takes the RE "c[on]*tr[o]*l" without the escapes.
They are not highlighted.  A simple search-forward does the highlighting.

Rich



reply via email to

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