[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: |
Fri, 23 May 2008 19:50:31 -0600 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Venkatesan Jeevanandam wrote:
> Bob Proulx wrote:
> > find . -name "*.soc" -exec grep PATTERN {} +
>
> 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'
Hmm... That find is perhaps too old to support the "{} +" syntax. I
don't remember about RHEL4. The "{} +" is the new and improved and
now POSIX standard best way. But relatively new. Older find commands
won't work. Please try the older syntax.
find . -name "*.soc" -exec grep PATTERN {} \;
The difference between "{} +" and "{} ;" can be found in the man
page. Basically "{} +" is more efficient. (And doesn't need the
semicolon escaped from the shell.) It is equivalent to this:
find . -name "*.soc" -print0 | xargs -r0 grep PATTERN /dev/null
But neither find -print0 nor xargs -0 were standardized and are GNU
extensions.
Seeing /tools/oss/packages/x86_64-rhel4/findutils/default/bin I have
to comment that it is a very strange thing to see in the path.
Bob