[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] Bash question: | in find
- Subject: [ale] Bash question: | in find
- From: jknapka at earthlink.net (Joe)
- Date: 24 Jan 2003 13:28:12 -0700
Geoffrey <esoteric at 3times25.net> writes:
> 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??
Yes, in this particular instance. But more generally, I want
to know how to execute a pipeline (as opposed to a single
command) in an "-exec" clause in a "find" command.
> Why not let tar do the 'grep' for you:
Well, because I didn't know tar would do that :-)
> for fn in $(find /cdrom/slackware -name '*.tgz' -print); do
> echo -n $fn " "
> tar tvzf $fn '*libXaw3d*' 2>/dev/null
> done |grep Xaw3d
Nice. Thanks.
> '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.
One slight problem: it needs an "echo" *after* the "tar" command,
otherwise *everything* comes out on one line.
Cheers,
-- Joe
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale