From owner-freebsd-questions Wed Feb 20 3:30:26 2002 Delivered-To: freebsd-questions@freebsd.org Received: from rwcrmhc52.attbi.com (rwcrmhc52.attbi.com [216.148.227.88]) by hub.freebsd.org (Postfix) with ESMTP id D78C637B405 for ; Wed, 20 Feb 2002 03:30:22 -0800 (PST) Received: from blossom.cjclark.org ([12.234.91.48]) by rwcrmhc52.attbi.com (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP id <20020220113022.EWXT1147.rwcrmhc52.attbi.com@blossom.cjclark.org>; Wed, 20 Feb 2002 11:30:22 +0000 Received: (from cjc@localhost) by blossom.cjclark.org (8.11.6/8.11.6) id g1KBUL025843; Wed, 20 Feb 2002 03:30:21 -0800 (PST) (envelope-from cjc) Date: Wed, 20 Feb 2002 03:30:21 -0800 From: "Crist J. Clark" To: rene@xs4all.nl Cc: questions@FreeBSD.ORG Subject: Re: how to search IN a bunch of files? Message-ID: <20020220033021.Z48401@blossom.cjclark.org> References: <20020220121803.E5644@xs4all.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20020220121803.E5644@xs4all.nl>; from rene@xs4all.nl on Wed, Feb 20, 2002 at 12:18:04PM +0100 X-URL: http://people.freebsd.org/~cjc/ 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, Feb 20, 2002 at 12:18:04PM +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. Two basic approches. Run grep(1) on each file once found, $ find /path -print -exec grep {} \; Or run find(1) to get the list of files and grep(1) them all, $ grep `find /path ` -- Crist J. Clark | cjclark@alum.mit.edu | cjclark@jhu.edu http://people.freebsd.org/~cjc/ | cjc@freebsd.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message