To: Irish Linux Users Group Subject: Re: [ILUG] Searching For files in zipped files Date: Sun, 26 May 2002 02:39:58 +0100 From: Brian Foster | Date: Fri, 24 May 2002 00:06:22 +0100 | From: "Justin (Home Office)" | | 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@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...