From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,9e32d0119366ce3c,start X-Google-Attributes: gidfee84,public From: Mark Sirota Subject: Re: UNIX command to search subdirs for text in a file Date: 1997/01/13 Message-ID: <32DAD336.23F8@isc.upenn.edu>#1/1 X-Deja-AN: 209686996 references: <01bc018d$8f170bc0$17ee1bac@usbgrjeff> to: Jeff Shervey content-type: text/plain; charset=us-ascii organization: University of Pennsylvania, ISC Network Engineering mime-version: 1.0 reply-to: msirota@isc.upenn.edu newsgroups: comp.unix.osf.osf1 x-mailer: Mozilla 3.01 (Win95; I) Jeff Shervey wrote: > With DEC UNIX 3.2 how can I search a bunch of subdirectories for a > certain file that contains certain text. > I'm trying this command with no luck: > > find . -name *.sql -print | grep -i "duplicate" *.pls Close. Try: find . -name \*.sql -print | xargs grep -i duplicate /dev/null The /dev/null is to ensure that grep will tell you the filename. Without it, if the last call to grep has only one file, you won't know the filename. -- Mark Sirota, Network Systems Engineer University of Pennsylvania, Information Systems and Computing msirota@isc.upenn.edu, 215/573-7214