* Doing a file filter with grep
@ 2007-01-25 22:37 RealityMonster
2007-01-26 9:29 ` Eli Zaretskii
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: RealityMonster @ 2007-01-25 22:37 UTC (permalink / raw)
To: help-gnu-emacs
So I've been getting find and grep working on my WinXP system with
emacs. I can finally properly search for files and search in files for
the things that I want. I'd like, however, to put a file filter on it,
so I can search just through .h files or .cpp files.
On the command line, I'd do something like this:
grep -r Pattern `find . -name *.cpp`
Doing
grep -r Pattern *.cpp
doesn't work because I'm running the command on a top level directory
that I want to recursively search through.
Emacs' find system relies on find-dired, which appends find-ls-option,
which prints all the matching files to a buffer, but that's not quite
what I want either.
I could write a more simple process exec function, I guess, but I like
the way that the find-dired stuff creates its output. I could also go
through the task of copying find-dired and changing it so it doesn't
have the ls option at the end, but that seems really clumsy.
I suppose this could be a command-line issue as well. grep could well
do what I want, but I don't see it in the man page. It's always been
easier to cobble together little bits that I DO know from other
programs anyway.
Any help here? Does emacs already do what I want somewhere else? M-x
apropos find is understandably enormous.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Doing a file filter with grep
2007-01-25 22:37 Doing a file filter with grep RealityMonster
@ 2007-01-26 9:29 ` Eli Zaretskii
2007-01-26 13:09 ` Kim F. Storm
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2007-01-26 9:29 UTC (permalink / raw)
To: help-gnu-emacs
> From: "RealityMonster" <jan.sacharuk@gmail.com>
> Date: 25 Jan 2007 14:37:45 -0800
>
> So I've been getting find and grep working on my WinXP system with
> emacs. I can finally properly search for files and search in files for
> the things that I want. I'd like, however, to put a file filter on it,
> so I can search just through .h files or .cpp files.
>
> On the command line, I'd do something like this:
>
> grep -r Pattern `find . -name *.cpp`
After typing "M-x grep RET" inside Emacs, make the Grep command be
this:
grep -r Pattern . --include="*.cpp"
That's it! no need to use `find'.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Doing a file filter with grep
2007-01-25 22:37 Doing a file filter with grep RealityMonster
2007-01-26 9:29 ` Eli Zaretskii
@ 2007-01-26 13:09 ` Kim F. Storm
2007-01-26 15:35 ` Jan Sacharuk
[not found] ` <mailman.3621.1169816967.2155.help-gnu-emacs@gnu.org>
[not found] ` <mailman.3618.1169803799.2155.help-gnu-emacs@gnu.org>
3 siblings, 1 reply; 6+ messages in thread
From: Kim F. Storm @ 2007-01-26 13:09 UTC (permalink / raw)
To: RealityMonster; +Cc: help-gnu-emacs
"RealityMonster" <jan.sacharuk@gmail.com> writes:
> So I've been getting find and grep working on my WinXP system with
> emacs. I can finally properly search for files and search in files for
> the things that I want. I'd like, however, to put a file filter on it,
> so I can search just through .h files or .cpp files.
>
> On the command line, I'd do something like this:
>
> grep -r Pattern `find . -name *.cpp`
Try M-x rgrep
(available only in Emacs 22).
>
> Any help here? Does emacs already do what I want somewhere else? M-x
> apropos find is understandably enormous.
So why didn't you try this :-)
C-h a grep RET
--
Kim F. Storm http://www.cua.dk
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Doing a file filter with grep
2007-01-26 13:09 ` Kim F. Storm
@ 2007-01-26 15:35 ` Jan Sacharuk
0 siblings, 0 replies; 6+ messages in thread
From: Jan Sacharuk @ 2007-01-26 15:35 UTC (permalink / raw)
To: storm; +Cc: help-gnu-emacs
I did, but it didn't appear to turn up anything useful. I'll take a
look at your suggestion when I get in to work. Thanks. :)
JS
On Jan 26, 2007, at 6:09 AM, Kim F. Storm wrote:
> "RealityMonster" <jan.sacharuk@gmail.com> writes:
>
>> So I've been getting find and grep working on my WinXP system with
>> emacs. I can finally properly search for files and search in files
>> for
>> the things that I want. I'd like, however, to put a file filter on
>> it,
>> so I can search just through .h files or .cpp files.
>>
>> On the command line, I'd do something like this:
>>
>> grep -r Pattern `find . -name *.cpp`
>
> Try M-x rgrep
>
> (available only in Emacs 22).
>
>>
>> Any help here? Does emacs already do what I want somewhere else? M-x
>> apropos find is understandably enormous.
>
> So why didn't you try this :-)
> C-h a grep RET
>
>
> --
> Kim F. Storm http://www.cua.dk
>
--
jan@chloris.ca
Cyclist at Large
Secret Asian Man
DNA neither cares nor knows.
DNA just is. And we dance to its music.
-Richard Dawkins
^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <mailman.3621.1169816967.2155.help-gnu-emacs@gnu.org>]
* Re: Doing a file filter with grep
[not found] ` <mailman.3621.1169816967.2155.help-gnu-emacs@gnu.org>
@ 2007-01-26 16:31 ` RealityMonster
0 siblings, 0 replies; 6+ messages in thread
From: RealityMonster @ 2007-01-26 16:31 UTC (permalink / raw)
To: help-gnu-emacs
Ah-ha. I checked my version, and I'm on 21.2. No wonder I didn't see
rgrep. :)
JS
On Jan 26, 6:09 am, no-s...@cua.dk (Kim F. Storm) wrote:
> "RealityMonster" <jan.sacha...@gmail.com> writes:
> > So I've been getting find and grep working on my WinXP system with
> > emacs. I can finally properly search for files and search in files for
> > the things that I want. I'd like, however, to put a file filter on it,
> > so I can search just through .h files or .cpp files.
>
> > On the command line, I'd do something like this:
>
> > grep -r Pattern `find . -name *.cpp`Try M-x rgrep
>
> (available only in Emacs 22).
>
>
>
> > Any help here? Does emacs already do what I want somewhere else? M-x
> > apropos find is understandably enormous.So why didn't you try this :-)
> C-h a grep RET
>
> --
> Kim F. Storm http://www.cua.dk
^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <mailman.3618.1169803799.2155.help-gnu-emacs@gnu.org>]
* Re: Doing a file filter with grep
[not found] ` <mailman.3618.1169803799.2155.help-gnu-emacs@gnu.org>
@ 2007-01-26 16:40 ` RealityMonster
0 siblings, 0 replies; 6+ messages in thread
From: RealityMonster @ 2007-01-26 16:40 UTC (permalink / raw)
To: help-gnu-emacs
Perfect. I read the man page, but I didn't realize '--include' was an
exclusive pattern (despite it saying that RIGHT THERE). This'll be easy
to write a wrapper around so I can search by directory and pattern
without having to type --include=*.foo all the time.
Thanks,
JS
On Jan 26, 2:29 am, Eli Zaretskii <e...@gnu.org> wrote:
> > From: "RealityMonster" <jan.sacha...@gmail.com>
> > Date: 25 Jan 2007 14:37:45 -0800
>
> > So I've been getting find and grep working on my WinXP system with
> > emacs. I can finally properly search for files and search in files for
> > the things that I want. I'd like, however, to put a file filter on it,
> > so I can search just through .h files or .cpp files.
>
> > On the command line, I'd do something like this:
>
> > grep -r Pattern `find . -name *.cpp`After typing "M-x grep RET" inside Emacs, make the Grep command be
> this:
>
> grep -r Pattern . --include="*.cpp"
>
> That's it! no need to use `find'.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-01-26 16:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-25 22:37 Doing a file filter with grep RealityMonster
2007-01-26 9:29 ` Eli Zaretskii
2007-01-26 13:09 ` Kim F. Storm
2007-01-26 15:35 ` Jan Sacharuk
[not found] ` <mailman.3621.1169816967.2155.help-gnu-emacs@gnu.org>
2007-01-26 16:31 ` RealityMonster
[not found] ` <mailman.3618.1169803799.2155.help-gnu-emacs@gnu.org>
2007-01-26 16:40 ` RealityMonster
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).