grep

Bruce Dumes bad at atrain.sw.stratus.com
Wed Oct 24 03:43:54 AEST 1990


In article <THOMAS.90Oct23163234 at uplog.uppsala.telesoft.se> thomas at uppsala.telesoft.se (Thomas Tornblom) writes:
>In article <1990Oct23.123025.18012 at kodak.kodak.com> tiefel at sunshine.Kodak.COM (Lenny Tiefel) writes:
>
>
>   I have a main directory with hundreds of subdirectories, 
>   and I want to find a file with a particular string, say "xyz"
>   The grep command only works in one directory at a time. Is there
>   a way of searching my whole directory structure to find a file
>   with a particular string?
>
>   Thanks.
>
>find <dir> -type f -name '*xyz*' -print
>
>Thomas

I don't think this is what Lenny was asking for.  I think "xyz" is a string
*IN* the file, not in the file name.

I have a little script called "locate_string".

-------------------- cut ---------------------------------------------
#
# Written by Bruce Dumes Sept 1990
#

if test !  "$2"
then    echo "Usage: locate_string search_dir string"
        exit
fi

temp=`find $1  -name "*" -type f -print`

grep $2 $temp

-------------------- cut ---------------------------------------------

Bruce
--
Bruce Dumes			|  "You don't see many of *these* nowdays, |
bad at zen.cac.stratus.com		|   do you?"				   |



More information about the Comp.unix.questions mailing list