Thursday 19 August 2010

Finding a single file in multiple jar files

this script copied from:
http://www.devdaily.com/blog/post/java/shell-script-search-search-multiple-jar-files-class-pattern


#!/bin/sh

LOOK_FOR="codehaus/xfire/spring"

for i in `find . -name "*jar"`
do
   echo "Looking in $i ..."
   jar tvf $i | grep $LOOK_FOR > /dev/null
   if [ $? == 0 ]
   then
     echo "==> Found \"$LOOK_FOR\" in $i"
   fi
done

No comments:

Post a Comment