From owner-freebsd-questions Sun Dec 21 19:46:00 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id TAA22546 for questions-outgoing; Sun, 21 Dec 1997 19:46:00 -0800 (PST) (envelope-from owner-freebsd-questions) Received: from prefetch.san.rr.com (ns1.san.rr.com [204.210.0.2]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id TAA22535 for ; Sun, 21 Dec 1997 19:45:53 -0800 (PST) (envelope-from Studded@dal.net) Received: from dal.net (dt051n19.san.rr.com [204.210.32.25]) by prefetch.san.rr.com (8.8.7/8.8.8) with ESMTP id TAA21148; Sun, 21 Dec 1997 19:44:06 -0800 (PST) Message-ID: <349DE206.9512157A@dal.net> Date: Sun, 21 Dec 1997 19:44:06 -0800 From: Studded X-Mailer: Mozilla 4.04 [en] (X11; I; FreeBSD 2.2.5-STABLE i386) MIME-Version: 1.0 To: John-David Childs , mike@chaski.com CC: freebsd-questions@FreeBSD.ORG Subject: Re: using the find command References: <199712211441.OAA13857@chaski.com> <19971221141158.00667@denver.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk John-David Childs wrote: > > On Sunday December 21, 1997, michael dorin > had this to say about "using the find command": > > > Can somebody give me the syntax for using the find command to search > > all the files in a tree for a specific string? > > > > find . -name "*" -exec grep -l string {} \; > > will give you the names of the files in the current tree which contain the > string you're looking for. > > If you search for the string directly (i.e. ....grep -ni string....) > then it won't tell you in which file(s) it found the string. Errrr... yes it will. :) 'grep -i string *' will do all the files in the same directory, and 'grep -iR string *' will recurse the tree. The -i option means do a case insensitive search. You can man grep for more info. Hope this helps, Doug