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

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

Doing a file filter with grep


From: RealityMonster
Subject: Doing a file filter with grep
Date: 25 Jan 2007 14:37:45 -0800
User-agent: G2/1.0

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.



reply via email to

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