Tagged: linux

find all jar files and print


I thought I need to print some jar files’ entries in my Java ME SDK’s lib directory.

$ zipinfo -1 cldc_1.8.jar
META-INF/
...
java/util/logging/StreamHandler.class
$

Then I tried to store those output to a text file.

$ zipinfo -1 cldc_1.8.jar > cldc_1.8.jar.txt
$ cat cldc_1.8.jar.txt
META-INF/
...
java/util/logging/StreamHandler.class
$

Then I need to change line delimiters for Windows..

$ unix2dos.exe cldc_1.8.jar.txt
unix2dos: converting file cldc_1.8.jar.txt to DOS format...
$

I realized I can do this in one command.

$ zipinfo -1 cldc_1.8.jar | unix2dos > cldc_1.8.jar.txt
$

And, finally, I can print all jar files entries in a command.

$ for j in *.jar;do zipinfo -1 $j | unix2dos > $j.txt;done
$