20

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?

3 Answers 3

31

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>
23

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.

1

If you just want to see a list of files in your zip archive use:

unzip -l tweets.zip

if you want to extract just some file:

unzip tweets.zip file-of-interest-as-it-is-pointed-in-the-archive

if you want something else, could you clarify your question?

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.