grep

Marten Terpstra a20 at nikhefh.nikhef.nl
Fri Oct 26 23:10:47 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?

A few months or so ago some people wanted to de the same thing. After a long
debate of the best solutions this is the one that should work best :

--start of script--
#! /bin/sh
# Recgrep : a version of grep which recursively searches every directory
# within current directory.
# Usage : recgrep <string>

find . -type f -exec grep $1 {} /dev/null \;
--end of script--

Marten
--
"               Quidquid Latine Dictum Sit, Altum Viditur.                    "
              ( Whatever is said in Latin, sounds profound )
-------------------------------------------------------------------------------
Marten Terpstra                                  National Institute for Nuclear
Internet : terpstra at nikhef.nl 	          	        and High Energy Physics
Oldie-net: {...}mcsun!nikhefh!terpstra    			     (NIKHEF-H)
                                                           PO Box 1882, 1009 DB
Phone-net: +31 20 592 5102			     Amsterdam, The Netherlands
-------------------------------------------------------------------------------



More information about the Comp.unix.questions mailing list