Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Feb 2002 12:28:21 +0100
From:      F.Xavier Noria <fxn@isoco.com>
To:        freebsd-questions@FreeBSD.org
Subject:   Re: how to search IN a bunch of files?
Message-ID:  <20020220122821.713524ea.fxn@isoco.com>
In-Reply-To: <20020220121803.E5644@xs4all.nl>
References:  <20020220121803.E5644@xs4all.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 20 Feb 2002 12:18:04 +0100
rene@xs4all.nl wrote:

: Hello. I'd like to be able to search in all files on my freebsd system for a
: given regexp. Yes, I want to search the contents of the files specified. 
: 
: I can get find(1) to supply me with a list of valid paths, but am unsure
: how to grep within all these files. an example would be appreciated.

If all files need to be considered:

    $ cd root_dir
    $ grep -r pattern .

If you need to filter out some of them:

    $ cd root_dir
    $ find . -name '*.foo' -print | xargs grep pattern

-- fxn

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020220122821.713524ea.fxn>