[ale] Bash question: | in find

Geoffrey esoteric at 3times25.net
Fri Jan 24 00:06:12 EST 2003


I'm trying to figure out what you're trying to do there. I think you're 
trying to locate the tarball that contains the Xawd library?? Why not 
let tar do the 'grep' for you:

for fn in $(find /cdrom/slackware -name '*.tgz' -print); do
	echo -n $fn " "
	tar tvzf $fn '*libXaw3d*' 2>/dev/null
done |grep Xaw3d

'echo -n' will print the file name without a newline, so the output of 
tar will be appended to the filename, and the 'grep' on the output of 
the for loop will print only those lines that contain the Xaw3d, hence 
all the files that did not contain the file you're looking for will be 
filtered out.


Joe wrote:
> Actually, the easy way to fix my problem would be to ask,
> "Where the heck do I get libXaw3d.so.7, in source or
> binary form, for a Slack 8.1 box?" Surely *someone*
> will know. (Google doesn't, though :( )
> 
> But the fun way to fix it is to run
> 
> find /cdrom/slackware -name "*.tgz" -exec tar tzvf {} | grep Xaw3d \; -print
> 
> on my Slack 8.1 CDROM.  You'd think that'd work, but the pipe | screws
> things up, since the shell gets it before find does. I tried \escaping
> the pipe \|, but that doesn't work - it then shows up as an *argument*
> to the tar command.
> 
> So. Anyone know how to include a pipe in a find -exec, short
> of wrapping the whole argument to -exec up in a script? (Hmm,
> guess I'll try that now.)
> 
> (And BTW, yes, I know it will take forever. But I gotta use up
> all those CPU cycles and I/O bandwidths (?) *somehow* :-)
> 
> Thanks,
> 
> -- Joe
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
> 
> 

-- 
Until later: Geoffrey		esoteric at 3times25.net

The latest, most widespread virus?  Microsoft end user agreement.
Think about it...

_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale






More information about the Ale mailing list