[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: using grep inside 2 levels of directory
From: |
Venkatesan Jeevanandam |
Subject: |
Re: using grep inside 2 levels of directory |
Date: |
Mon, 30 May 2011 03:58:58 -0700 (PDT) |
Hi,
To grep into files in multiple levels of directory, use
find . -name "*.ext" |xargs grep -i
I think this will be useful.
Regards,
Venkat
Venkatesan Jeevanandam wrote:
>
> Hi Bob,
> Thanks for your reply.
>
> I used the command the way you specified, but I am getting the below
> error.
> /tools/oss/packages/x86_64-rhel4/findutils/default/bin/find: missing
> argument to `-exec'
>
> Thanks,
> Venkat.
>
>
> Bob Proulx wrote:
>>
>> 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 {} +
>>
>> Bob
>>
>>
>>
>>
>
>
--
View this message in context:
http://old.nabble.com/using-grep-inside-2-levels-of-directory-tp17402549p31732387.html
Sent from the Gnu - Grep mailing list archive at Nabble.com.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: using grep inside 2 levels of directory,
Venkatesan Jeevanandam <=