Path: utzoo!telly!attcan!ron From: ron@attcan.UUCP (Ron Joma) Newsgroups: comp.unix.questions Subject: Re: grep Message-ID: <12910@vpk3.UUCP> Date: 1 Nov 90 14:37:08 GMT References: <1990Oct23.123025.18012@kodak.kodak.com> <658@llnl.LLNL.GOV> Organization: AT&T Canada Inc., Toronto Lines: 28 In article <658@llnl.LLNL.GOV>, rjshaw@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! * ******************************************************************************