all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How do I grep multiple files in Emacs?
@ 2008-12-18 21:56 deech
  2008-12-18 21:57 ` harven
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: deech @ 2008-12-18 21:56 UTC (permalink / raw)
  To: help-gnu-emacs

Hi all,
I frequently have to search multiple files/ buffers for a word/phrase.
Is there any way to do this in Emacs without dropping into the shell?

-deech


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

* Re: How do I grep multiple files in Emacs?
  2008-12-18 21:56 How do I grep multiple files in Emacs? deech
@ 2008-12-18 21:57 ` harven
  2008-12-18 22:09   ` deech
  2008-12-18 22:50 ` Drew Adams
  2008-12-19 11:00 ` Fabrice Niessen
  2 siblings, 1 reply; 6+ messages in thread
From: harven @ 2008-12-18 21:57 UTC (permalink / raw)
  To: help-gnu-emacs

deech <aditya.siram@gmail.com> writes:

> Hi all,
> I frequently have to search multiple files/ buffers for a word/phrase.
> Is there any way to do this in Emacs without dropping into the shell?
>
> -deech

M-x rgrep


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

* Re: How do I grep multiple files in Emacs?
  2008-12-18 21:57 ` harven
@ 2008-12-18 22:09   ` deech
  2008-12-19  6:29     ` Thierry Volpiatto
  0 siblings, 1 reply; 6+ messages in thread
From: deech @ 2008-12-18 22:09 UTC (permalink / raw)
  To: help-gnu-emacs

Awesome! Thanks!


On Dec 18, 3:57 pm, harven <har...@free.fr> wrote:
> deech <aditya.si...@gmail.com> writes:
> > Hi all,
> > I frequently have to search multiple files/ buffers for a word/phrase.
> > Is there any way to do this in Emacs without dropping into the shell?
>
> > -deech
>
> M-x rgrep



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

* RE: How do I grep multiple files in Emacs?
  2008-12-18 21:56 How do I grep multiple files in Emacs? deech
  2008-12-18 21:57 ` harven
@ 2008-12-18 22:50 ` Drew Adams
  2008-12-19 11:00 ` Fabrice Niessen
  2 siblings, 0 replies; 6+ messages in thread
From: Drew Adams @ 2008-12-18 22:50 UTC (permalink / raw)
  To: 'deech', help-gnu-emacs

> I frequently have to search multiple files/ buffers for a word/phrase.
> Is there any way to do this in Emacs without dropping into the shell?

C-h r

g Grep Searching

IOW, see node `Grep Searching' of the Emacs manual.





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

* Re: How do I grep multiple files in Emacs?
  2008-12-18 22:09   ` deech
@ 2008-12-19  6:29     ` Thierry Volpiatto
  0 siblings, 0 replies; 6+ messages in thread
From: Thierry Volpiatto @ 2008-12-19  6:29 UTC (permalink / raw)
  To: help-gnu-emacs

deech <aditya.siram@gmail.com> writes:

> Awesome! Thanks!
>
>
> On Dec 18, 3:57 pm, harven <har...@free.fr> wrote:
>> deech <aditya.si...@gmail.com> writes:
>> > Hi all,
>> > I frequently have to search multiple files/ buffers for a word/phrase.
>> > Is there any way to do this in Emacs without dropping into the shell?
>>
>> > -deech
>>
>> M-x rgrep

Have a look at traverselisp.el that provide more features than rgrep and
is now integrated in anything and dired.
Have a look also at moccur.el.
You will find the both easily on EmacsWiki.

-- 
A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France





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

* Re: How do I grep multiple files in Emacs?
  2008-12-18 21:56 How do I grep multiple files in Emacs? deech
  2008-12-18 21:57 ` harven
  2008-12-18 22:50 ` Drew Adams
@ 2008-12-19 11:00 ` Fabrice Niessen
  2 siblings, 0 replies; 6+ messages in thread
From: Fabrice Niessen @ 2008-12-19 11:00 UTC (permalink / raw)
  To: help-gnu-emacs-mXXj517/zsQ

deech,

> I frequently have to search multiple files/ buffers for a
> word/phrase. Is there any way to do this in Emacs without
> dropping into the shell?

In my `.emacs' file, I've mapped `C-c 1', `C-c 2' and `C-c 3'
-- I know, this is normally not advised -- to do different
levels of grepping:

    o   C-c 1 searches for a pattern in the file name;

    o   C-c 2 searches for a pattern in the file contents, but
        only displays the file names which are relevant;

    o   C-c 3 searches for a pattern in the file contents, and
        displays all lines which are relevant.

Keys are more or less bound from the less to the most
"verbose"... 1, 2, 3...

--8<---------------cut here---------------start------------->8---
;; search for files with names matching a wild card pattern and Dired the
;; output
(global-set-key [(control c) ?1] 'find-name-dired)

;; search for files with contents matching a wild card pattern and Dired the
;; output
(global-set-key [(control c) ?2] 'find-grep-dired)

;; run grep via find, with user-specified arguments
(global-set-key [(control c) ?3] 'grep-find)

;; ignore `.svn' and `CVS' directories
(setq grep-find-command
      (concat
       "find . \\( -path '*/.svn' -o -path '*/CVS' \\) -prune -o -type f "
              "-print0 | xargs -0 -e grep -i -n -e "))
--8<---------------cut here---------------end--------------->8---

See (info "(emacs)Dired and Find") for further info.

And, if you wish so, you can have a look at the rest of my
`.emacs' file at:

    http://www.mygooglest.com/fni/dot-emacs.html

Best regards,
  Fabrice Niessen

_________________________________________________________________________
Fabrice Niessen
Search the Web with "My Google Search Tools" on http://www.MyGooglest.com


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

end of thread, other threads:[~2008-12-19 11:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-18 21:56 How do I grep multiple files in Emacs? deech
2008-12-18 21:57 ` harven
2008-12-18 22:09   ` deech
2008-12-19  6:29     ` Thierry Volpiatto
2008-12-18 22:50 ` Drew Adams
2008-12-19 11:00 ` Fabrice Niessen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.