I'm wanting to recursively search my maven repository (an n folder deep heirachy of jars) for a specific class inside an unknown jar.
jar -tvf myJar.jar | grep ClassIWant.class works great for a known jar but I'm having problems piping/chaining bash commands to achieve a recursive search.
Any hints much appreciated.
Related: BASH :: find file in archive from command line
find -name \*.jar | xargs -n1 -iFILE sh -c "jar tvf FILE | sed -e s#^#FILE:#g" | grep classIWant\\.class | cut -f1 -d:
Bash 4+
shopt -s globstar
for file in **/*.jar
do
jar -tvf "$file" | grep ....
done
<4++
find /path -type f -name "*.jar" | while read -r FILE
do
jar -tvf "$FILE" | grep ....
done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With