Michael C. Toren on Fri, 11 Oct 2002 19:07:23 -0400


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

Re: [PLUG] list by owner


> You're sure it's either a Perl script or a /bin/sh script, and
> you're sure it calls GNU tar as gtar somewhere inside. If you're me,
> you'd do something like this (forgive me typos, I'm not testing it):
> 
>   find /foo -type f \( -name \*.sh -o -name \*.pl \) \
>     -exec echo {} \&\& grep -C gtar {} > /tmp/found

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 {} \;

-mct