Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

print content of more than one file in a zip archive

Tags:

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?

like image 263
nikosdi Avatar asked Nov 23 '13 13:11

nikosdi


People also ask

Is there a way to print all documents in a ZIP file?

If you are looking to print the entire contents of your archive, use the Classic window display. You can also print a listing of the files in an archive from a Windows Explorer window. Simply right click on the archive and choose Print from the right click shortcut menu.

How do I print multiple zip files at once?

Press [Ctrl], and select the files you want to print. (If the files are adjacent, select the first file in the list, press [Shift], and select the last file in the list.) Right-click the selection, and select Print from the shortcut menu. Select the desired print options, and click OK.


2 Answers

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>
like image 62
Emanuel Couto Avatar answered Oct 30 '22 17:10

Emanuel Couto


Use the -p option of unzip to pipe the output. Multiple files are concatenated. The -c option does the same thing, but includes the file name in front of each file.

like image 38
Mark Adler Avatar answered Oct 30 '22 17:10

Mark Adler