grep

Robert Garvey robert at satori.sybase.com
Fri Oct 26 09:52:14 AEST 1990


In article <1990Oct23.143247.5639 at lgc.com> max at lgc.com (Max Heffler) writes:
>Try this:
>
>	cd x		where x is head of tree to search
>	find . -type f -exec grep xyz {} /dev/null \; | tee $HOME/xyz.out
>
>The /dev/null is to cause grep to report back the filenames where the string
>is found, since grep will not report the filename for a single argument.

I'd recommend adding the -l option to the grep command.  Lines that
contain the pattern are not output, only the name of the file(s) that
have at least one instance.  This option works as you'd like if grep is
searching on a single file; its name is output.

Robert Garvey                                Sybase, Inc
robert at sybase.com                            6475 Christie Ave
{sun,lll-tis,pyramid,pacbell}!sybase!robert  Emeryville, CA 94608-1010



More information about the Comp.unix.questions mailing list