Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Feb 2002 11:34:19 +0000
From:      Matt H <freebsd-questions@cuntbubble.com>
To:        "rene@xs4all.nl" <rene@xs4all.nl>
Cc:        questions@FreeBSD.ORG
Subject:   Re: how to search IN a bunch of files?
Message-ID:  <20020220113419.62b8a14e.freebsd-questions@cuntbubble.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" <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.
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message
> 

there's the -exec part of find

find / -exec grep "regex" {} \;


or if there's not too many results from find do :

grep "regex" `find /`


or print out some stuff as you go along 

find / | awk '{ print Grepping $0; cmd = sprintf "grep \"regex\" %s"; system(cmd)}'

(which might lead to some interesting escaping in the regex - depends on the regex)

etc. etc.

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?20020220113419.62b8a14e.freebsd-questions>