Created
July 5, 2011 14:31
-
-
Save sourcerebels/1064936 to your computer and use it in GitHub Desktop.
Not very well optimized script for searching recursively with regular expresions in several jar files. TO IMPROVE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function usage() { | |
echo "usage: findInJars <path> <regexp>" | |
exit 1 | |
} | |
[ $# -ne 2 ] && usage | |
jar=$(which jar) | |
path=$1 | |
class=$2 | |
[ $? -ne 0 ] && echo "No jar executable found in your PATH" | |
find $path -name '*.jar' | while read jarFile; do | |
$jar tvf $jarFile | grep $class > /dev/null | |
if [ $? -eq 0 ]; then | |
echo "**********************************************************************************" | |
echo "Class $class found on jar $jarFile" | |
echo "**********************************************************************************" | |
$jar tvf $jarFile | grep $class | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment