From owner-freebsd-questions Wed Feb 20 3:34:30 2002 Delivered-To: freebsd-questions@freebsd.org Received: from pc1-dale5-0-cust136.not.cable.ntl.com (pc1-dale5-0-cust136.not.cable.ntl.com [80.1.76.136]) by hub.freebsd.org (Postfix) with SMTP id 55A7037B402 for ; Wed, 20 Feb 2002 03:34:24 -0800 (PST) Received: (qmail 65279 invoked from network); 20 Feb 2002 11:34:19 -0000 Received: from localhost (HELO matt.thebigchoice.com) (127.0.0.1) by localhost with SMTP; 20 Feb 2002 11:34:19 -0000 Date: Wed, 20 Feb 2002 11:34:19 +0000 From: Matt H To: "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> X-Mailer: Sylpheed version 0.7.1 (GTK+ 1.2.10; i386--freebsd4.4) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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. > > 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