[darcs-users] Re: a bash tip for easily excluding the _darcs directory
Mark Stosberg
mark at summersault.com
Wed Mar 9 14:07:09 UTC 2005
On 2005-03-09, Ralph Corderoy <ralph at inputplus.co.uk> wrote:
>
> Hi Gerhard,
>
>> > Please consider suggesting xargs(1) since it saves many invocations of
>> > grep.
>> > find . \( -path ./_darcs -o -path ./subrepo/_darcs \) -prune -o \
>> > -print |
>> > xargs grep string /dev/null
>>
>> Better yet use zero-ended strings if some of the files contain spaces
>> in the filename
>>
>> find . \( -path ./_darcs -o -path ./subrepo/_darcs \) -prune -o \
>> -print0 |
>> xargs -0 grep string /dev/null
I think the use of "-path" here is more complicated then it needs to be,
especially if you more than one sub-repo. This will work instead:
find . \! -path '*_darcs*' -prune -o -print0 | xargs -0 grep string
I also wasn't clear what '/dev/null' did, so I removed it. :)
> People may not have GNU find and GNU xargs. Have the NUL versions
> reached POSIX yet?
These "NUL" options have reached FreeBSD at least, which means they've
reach Mac OS X, too.
Mark
More information about the darcs-users
mailing list