grep

Dean Riddlebarger dean at truevision.com
Thu Oct 25 01:00:43 AEST 1990


In article <1990Oct23.143247.5639 at lgc.com> max at lgc.com (Max Heffler) 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?
>>
>Try this:
>
>	cd x		where x is head of tree to search
>	find . -type f -exec grep xyz {} /dev/null \; | tee $HOME/xyz.out
>

I fire off a global find every night that dumps my login tree to a file.
[Nothing sacred about location....I throw mine into $HOME/lib].  I also have
a trivial script called 'findit' in my personal bin [$HOME/bin].  This
script is nothing more than a grep into the file that the nightly find
has created; its only advantage over grep is that I find it mnemonically
"pretty".

So, assuming I'm not looking for files that have undergone major name
changes since the previous evening, I just enter 'findit filename' and
get my pattern match very quickly.  I like this because a find on a
large tree in interactive mode can take quite    a      loooonnnngg
   time.......:-)


-- 
<:>   Dean Riddlebarger                               "The bus came by   <:>
<:>   MIS Manager - Truevision, Inc.                    and I got on,    <:>
<:>   [317] 841-0332                                   That's when it    <:>
<:>   uucp: uunet!epicb!dean   dean at truevision.com      all began."      <:>



More information about the Comp.unix.questions mailing list