| Date: Fri, 24 May 2002 00:06:22 +0100
| From: "Justin (Home Office)" <macarthy at iol.ie>
|
| Hi I'm looking for a quick bash script to get a list of all the *.jar
| files that have the file SAXParser.class in them
|
| find /c -name '*.jar' -exec unzip -l '{}' \; | \
| grep 'SAXParser.class' >/c/results.txt
|
| This nearly does it, but I really want '{}' (ie the jar filename)
| Any bash gurus have an idea?
when in doubt, do the simple thing --- write a _shell_ script,
rather that what is in essence a _find_ script .... I would
use something like:
find /c -name '*.jar' -print | while read jar; do
unzip -l $jar | grep 'SAXParser.class' >/dev/null && echo $jar
done >/c/results.txt
the above is not tested; your mileage may vary; there
are obvious robustness issues but they seem unlikely
to matter (per request for a "quick script") ....
cheers!
-blf-
--
Innovative, very experienced, Unix and | Brian Foster Dublin, Ireland
Chorus (embedded RTOS) kernel internals | e-mail: blf at utvinternet.ie
expert looking for a new position ... | mobile: (+353 or 0)86 854 9268
For a resume, contact me, or see my website http://www.blf.utvinternet.ie
Stop E$$o (ExxonMobile): ``Whatever you do, don't buy Esso --- they
don't give a damn about global warming.'' http://www.stopesso.com
Supported by Greenpeace, Friends of the Earth, and numerous others...
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!