print content of more than one file in a zip archive

nikosdi picture nikosdi · Nov 23, 2013 · Viewed 15.6k times · Source

I have some zip files that are really large and I want to print them without extracting first. I am using zcat and zless to do that and then I redirect the output to a different application. When my zip file contains more than one text file I receive the following error:

zcat tweets.zip >a
gzip: tweets.zip has more than one entry--rest ignored

How can I do what I want with zip files that contain more than one text file?

Answer

Emanuel Couto picture Emanuel Couto · Nov 25, 2014

You can do this to output a file without extracting:

$ unzip -p <zip_file> <file_to_print>

For example:

$ unzip -p MyEar.ear META-INF/MANIFEST.MF

As cur4so mentioned you can also list all files using:

$ unzip -l <zip_file>