grep
Kartik Subbarao
subbarao at phoenix.Princeton.EDU
Tue Apr 16 05:43:04 AEST 1991
In article <1991Apr14.214414.9815 at hellgate.utah.edu> rnelson%hell.utah.edu at cs.utah.edu writes:
>
>
> Does anyone know if there is an easy way to recursively search for a
>pattern down the entire file tree of a directory?
> I have tried : grep -R pattern *
>
If you know the depth you want to search, you can say:
grep pattern */* (i.e matches all files of all subdirectories)
you can go as far as you want, i.e grep pattern */*/*
Another way is to use find:
find . -exec grep pattern "{}" \;
or you could use xargs:
find . -print | xargs grep pattern.
-Kartik
--
internet# rm `df | tail +2 | awk '{ printf "%s/quotas\n",$6}'`
subbarao at phoenix.Princeton.EDU -| Internet
kartik at silvertone.Princeton.EDU (NeXT mail)
SUBBARAO at PUCC.BITNET - Bitnet
More information about the Comp.unix.questions
mailing list