From owner-freebsd-questions Thu Dec 27 15:16:47 2001 Delivered-To: freebsd-questions@freebsd.org Received: from pintail.mail.pas.earthlink.net (pintail.mail.pas.earthlink.net [207.217.120.122]) by hub.freebsd.org (Postfix) with ESMTP id 3F61537B417 for ; Thu, 27 Dec 2001 15:16:42 -0800 (PST) Received: from dialup-209.244.104.36.dial1.sanjose1.level3.net ([209.244.104.36] helo=blossom.cjclark.org) by pintail.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 16JjlQ-0004xE-00; Thu, 27 Dec 2001 15:16:41 -0800 Received: (from cjc@localhost) by blossom.cjclark.org (8.11.6/8.11.3) id fBRNGbM07051; Thu, 27 Dec 2001 15:16:37 -0800 (PST) (envelope-from cjc) Date: Thu, 27 Dec 2001 15:16:37 -0800 From: "Crist J . Clark" To: Joe Clarke Cc: Drew Tomlinson , questions@FreeBSD.ORG Subject: Re: How To Recursively Search Directory For Text String In Files? Message-ID: <20011227151637.J2090@blossom.cjclark.org> References: <011701c18f24$951d3b00$c42a6ba5@lc.ca.gov> <20011227172121.Q11529-100000@shumai.marcuscom.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20011227172121.Q11529-100000@shumai.marcuscom.com>; from marcus@marcuscom.com on Thu, Dec 27, 2001 at 05:23:33PM -0500 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 Thu, Dec 27, 2001 at 05:23:33PM -0500, Joe Clarke wrote: > > > On Thu, 27 Dec 2001, Drew Tomlinson wrote: > > > OK, I am beginning to understand the power of FBSD and am sure this is > > possible. I just don't know how to do it. What I want to do is search > > all files in my current directory and all the directories below it for a > > text string and then know what file(s) contains the string. I > > understand that grep will do the search but my knowledge is limited to > > "cat file.txt | grep string". How can I construct a command in tcsh to > > feed each file to cat and then feed it to grep *AND* know the name of > > the file grep found the match? Do I have the right concept? Is there a > > better way to accomplish my goal? > > > > You can do grep -r *, but I prefer: Actually, $ grep -r . Would be the better way to search the cwd. -- "It's always funny until someone gets hurt. Then it's hilarious." 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