How to search the contents of a list of jar/tar files

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;

About SoCRaT

Systems Engineer, OSS & Linux Geek
This entry was posted in Uncategorized and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s