-q will suppress verbose output from the unzip program
-c will extract to stdout
Example:
$ unzip -q -c commons-lang-2.4.jar META-INF/MANIFEST.MF
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: 1.5.0_13-119 (Apple Inc.)
Package: org.apache.commons.lang
Extension-Name: commons-lang
Specification-Version: 2.4
Specification-Vendor: Apache Software Foundation
Specification-Title: Commons Lang
Implementation-Version: 2.4
Implementation-Vendor: Apache Software Foundation
Implementation-Title: Commons Lang
Implementation-Vendor-Id: org.apache
X-Compile-Source-JDK: 1.3
X-Compile-Target-JDK: 1.2
Alternatively you can use -p instead of -q -c.
-p extract files to pipe (stdout). Nothing but the file data is sent to stdout, and the files are always extracted in binary format, just as they are stored (no conversions).
that will quietly (-q) read the path META-INF/MANIFEST.MF from the jarfile (which is compressed using the zip format) to stdout (-c). You can then pipe the output to other command to answer questions like 'what is the main class for this jar:
(this removes all lines which don't contain the string Main-Class, then splits the line at :, keeping only the second field, the class name). Of course, either define $JARFILE_PATH appropriately or replace $JARFILE_PATH with the path to a jarfile you're interested in.
Others have been posting about using unzip -p and piping to grep or awk or whatever you need. While that works for most cases, it's worth noting that because of the 72 characters-per-line limit of MANIFEST.MF, you may be grepping for keys whose values are split across multiple lines and will therefore be very difficult to parse. I'd love to see a CLI tool that can actually pull a rendered value out of the file.