[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using grep inside 2 levels of directory

From: Bob Proulx
Subject: Re: using grep inside 2 levels of directory
Date: Thu, 22 May 2008 17:01:13 -0600
User-agent: Mutt/1.5.13 (2006-08-11)

Venkatesan Jeevanandam wrote:
> I have to grep for "text" inside a directory for files "*.soc".
> ...
> I want to search for "text" using grep command for all *.soc files in all
> "arch*/core*" folders.
> I tried like this, but it doesnt help me.
> $pwd
> /home/venkat/project
> $grep */*/*soc (not working)

I don't see a pattern there.  In which case grep will use the first
expanded filename as the pattern.  Perhaps you meant to use this:

  grep PATTERN */*/*soc

> I want to grep in files like, using one command.
> arch1/core1/*.soc
> arch1/core2/*soc
> arch1/core3/*soc
> arch2/core1/*soc

I would use find rather than the shell to select the files and then
have find call grep.

  find . -name "*.soc" -exec grep PATTERN {} +


reply via email to

[Prev in Thread] Current Thread [Next in Thread]