gabriel rosenkoetter on Sat, 12 Oct 2002 00:30:04 -0400


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

Re: [PLUG] list by owner


On Fri, Oct 11, 2002 at 07:07:21PM -0400, Michael C. Toren wrote:
> Or, use xargs so that you don't end up forking off a copy of grep
> for each filename find returns:
> 
> 	find /foo -type f \( -name \*.sh -o -name \*.pl \) \
> 		-print0 | xargs -0 grep -C gtar 
> 
> Alternatively, if you *really* want to display the name of each
> file as you're examining it's contents, try something like:
> 
> 	find /foo -type f \( -name \*.sh -o -name \*.pl \) \
> 		-exec echo {} \; -exec grep -C gtar {} \;

Surely, you meant:

  find /foo -type f \( -name \*.sh -o -name \*.pl \) \
    -exec echo {} >2 \; -print0 | xargs -0 grep -C gtar

;^>

-- 
gabriel rosenkoetter
gr@eclipsed.net

Attachment: pgpHHR5dsZ4KV.pgp
Description: PGP signature