Path: utzoo!telly!attcan!uunet!epicb!dean From: dean@truevision.com (Dean Riddlebarger) Newsgroups: comp.unix.questions Subject: Re: grep Summary: Merge for the best of both worlds. Keywords: Use find, and grep Message-ID: <490@epicb.com> Date: 24 Oct 90 15:00:43 GMT References: <1990Oct23.123025.18012@kodak.kodak.com> <1990Oct23.143247.5639@lgc.com> Organization: Truevision Inc., Indianapolis, IN Lines: 33 In article <1990Oct23.143247.5639@lgc.com> max@lgc.com (Max Heffler) writes: >In article <1990Oct23.123025.18012@kodak.kodak.com> tiefel@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@truevision.com all began." <:>