From owner-freebsd-questions Wed Feb 20 12:50:31 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mired.org (dsl-64-192-6-133.telocity.com [64.192.6.133]) by hub.freebsd.org (Postfix) with SMTP id 4CEDC37B419 for ; Wed, 20 Feb 2002 12:50:17 -0800 (PST) Received: (qmail 18152 invoked by uid 100); 20 Feb 2002 20:50:09 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15476.3072.832733.781406@guru.mired.org> Date: Wed, 20 Feb 2002 14:50:08 -0600 To: F.Xavier Noria Cc: questions@freebsd.org, rene@xs4all.nl Subject: Re: how to search IN a bunch of files? In-Reply-To: <69372926@toto.iv> X-Mailer: VM 6.90 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`;h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ From: "Mike Meyer" X-Delivery-Agent: TMDA/0.46 (Python 2.2; freebsd-4.5-STABLE-i386) 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 F.Xavier Noria types: > On Wed, 20 Feb 2002 12:18:04 +0100 > rene@xs4all.nl wrote: > 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 Might I suggest a minor tweak to this? Use "xargs grep -H pattern", so that in the unlikely case that you only have one file, you still get the file name printed. http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message