Skip to content

Instantly share code, notes, and snippets.

@shyiko
Created May 19, 2011 13:00
Show Gist options
  • Save shyiko/980697 to your computer and use it in GitHub Desktop.
Save shyiko/980697 to your computer and use it in GitHub Desktop.
Looks for class inside JARs/WARs/EARs/SARs
#!/bin/bash
DIRECTORY=$1
CLASS_NAME=$2
find $DIRECTORY -name '*.[jwes]ar' | while read LINE; do
grep -q $CLASS_NAME "$LINE";
if [ $? -eq 0 ]; then
REFERENCES=$(jar tvf "$LINE" | grep $CLASS_NAME);
if [ -n "$REFERENCES" ]; then
echo "$LINE";
echo "$REFERENCES";
echo;
fi;
fi;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment