Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Dec 1997 14:11:58 -0700
From:      John-David Childs <jdc@nterprise.net>
To:        freebsd-questions@freebsd.org
Subject:   Re: using the find command
Message-ID:  <19971221141158.00667@denver.net>
In-Reply-To: <199712211441.OAA13857@chaski.com>; from michael dorin on Sun, Dec 21, 1997 at 02:41:54PM %2B0000
References:  <199712211441.OAA13857@chaski.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sunday December 21, 1997, michael dorin <mike@chaski.com>
 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.

Someone else may have a better idea how to do this.  It seems trivial to
write a shell script to first get the names of the files containing
<string> and then grep each file in turn.
--

> Any help will be apreciated.
> 
> Thanks,
>  Mike

-- 
John-David Childs (JC612)       Enterprise Internet Solutions
System Administrator            @denver.net/Internet-Coach/@ronan.net
  & Network Engineer            1031 S. Parker Rd. #I-8 Denver, CO 80231
As of this^H^H^H^H next week, passwords will be entered in Morse code.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19971221141158.00667>