查找jar 包中重复的 class 文件的脚本

for jarf in ` find . -name \*.jar -print `
do
   jar tvf "$jarf" | awk '{ print $6 }' >>tmpfile
   jar tvf "$jarf" | awk '{ print ''"'"$jarf"'"'',$6}' >>tmpfile2
done
sort tmpfile |uniq -d >tmpfile3
for dclass in `cat tmpfile3`
do
   printf "dumplicate class:[%s]\n" $dclass
   grep "$dclass" tmpfile2
   printf "duplicate class end \n"
done

 

SHELL脚本,运行即可

你可能感兴趣的:(Class)