grep
Ron Joma
ron at attcan.UUCP
Fri Nov 2 01:37:08 AEST 1990
In article <658 at llnl.LLNL.GOV>, rjshaw at ramius.llnl.gov (Robert Shaw) writes:
> Question from Len Teifel:
> |
> | 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 ~ -name \*xyz\* -print
>
> Or, not quite as nice: ls -R ~ | grep xyz
>
I think that Len is looking for a pattern inside of the files, not
in the file names. To find a keyword in a file, use the following
pipe:
find path -print | xargs grep "pattern"
The find creates the path names, xargs converts these to arguements,
thus forcing grep to look inside each file being passed along.
******************************************************************************
* Ronald Joma * I speak to the masses through the media, *
* AT&T - Montreal * And if you have anything to say to me *
* attcan!cmtl01!ron * You can say it with CASH! *
******************************************************************************
More information about the Comp.unix.questions
mailing list