grep

Pat Alvarado pa1 at tdatirv.UUCP
Fri Oct 26 01:09:53 AEST 1990


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:

find . -type f -exec grep -l string {} \;

This will tell find to start from the current directory (.) and with
each file only (-type f) execute a grep with the -l option for your 
string. The grep -l option will only display the filename if the string
was found.


-- 
  |||   Pat Alvarado                | 
   v    Teradata Corporation        | tdat!pa1 at suntzu.sun.com
 /\ /\  100 N. Sepulveda Blvd.      | uunet!edsews!hacgate!tdat!pa1
/// \\\ El Segundo, Calif. 90245    | pa1 at tdat.teradata.com



More information about the Comp.unix.questions mailing list