Skip to content

Instantly share code, notes, and snippets.

@obedmhg
Created October 27, 2020 17:43
Show Gist options
  • Save obedmhg/9d52e80f7b8613513f8e58e6019fa9e9 to your computer and use it in GitHub Desktop.
Save obedmhg/9d52e80f7b8613513f8e58e6019fa9e9 to your computer and use it in GitHub Desktop.
find_in_jar.sh
#!/bin/bash
#serch all jar files
for jar in $(find -name \*.jar); do
files=$(unzip -l $jar | grep -i '*\.[xml|properties]' | awk '{print $4}');
for file in $files; do
#check if the found file contains 'test.log'
if unzip -p $jar $file | grep -i 'test\.log'; then
#print the found jar and file name
echo " $jar $file ";
fi ;
done;
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment