If you have a directory, for example /home/mhewedy/libs/jars/, this directory contains many jar/tar files, and you want to search the contents of these jar/tar files .
use this command :
cd /home/mhewedy/libs/jars/
for jar in *.jar; do echo "--- $jar ---" ; jar tf $jar | grep NullPointerException ; done;
Note, you may also use this command to search a list of tars for its contents:
for tar in *.tar; do echo "--- $tar ---" ; tar tf $tar | grep some_file_name ; done;
Subscribe to:
Post Comments (Atom)
3 comments:
Does this decompress and search the archived file on the fly?
Amazing! Thanks! Any idea about how we can do the same with a .tar.gz or .tar.bz2 (compressed) file?
I just tried to print the contents of a .tgz file with the same command and it went well. i believe it should work too with .bz2 as it or with small modifications.
Post a Comment