I have a question regarding unzip command in Unix. As of now my Unix command unzip -p -a is able to zip the file which are lesser in size. But if the file size is larger then the command is not able to unzip it.

Consider the file name is file1.zip and when I give unzip -p -a and while the command executes, it shows the content of the file in the Unix box.
I want to know the same 7z command. @Volker: you have suggested as COMMANDTOUSE="/usr/bin/7z e -so -bd .. but its not working.

This is how much code is defined,

if the file is in zip format, then the unzip -p -a comes into picture. yes the command works for smaller files, and if fails for larger size. I have tried with 7z e -so -bd but its failing. @Volker : can you suggest an alternate command. Thanks for your continuous help till now.

  • 1
    Larger... than what? – ssice Oct 29 '14 at 14:29
  • larger is a comparative, i.e., you need to compare "935M" to something. – ssice Oct 29 '14 at 18:00
  • @ssice : please find the additional details above. – chandra prakash Oct 30 '14 at 11:18
  • Can any of you guyz have a look and give me a update? its pretty much important – chandra prakash Oct 31 '14 at 13:11
  • @chandraprakash So you mean a 935MB file is a large file example? (It could be the small file, in comparison: comparing to 2GB, see next.) There are various reports that some implementation of zip does not support files larger than 4GB, and sometimes larger than 2GB (maybe larger or equal). That would explain your problem, if the large file was larger than 2GB - but it's smaller. But I did not see any similar reports with files smaler than 2GB – Volker Siegel Nov 3 '14 at 7:44

The direct aequivalent of unzip -p -a for 7zip is 7z e -so -bd. But that complains it does not want to write to stdout (even if I clearly told itso):

$ 7z e -so -bd file.zip 
7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,8 CPUs)

I won't write data and program's messages to same terminal

To make it not complain, you need to pipe or redirect the output of it somewhere else. For example, to read the output on the screen:

$ 7z e -so -bd file.zip | less

or to save it to a file:

$ 7z e -so -bd file.zip > file-all.txt
| improve this answer | |
  • Hi Volker .. thanks for the answer..it was helpful.But we need to use this command in a program for data extraction which will be available in a particular path...so I just need to know the corresponding 7z command for COMMANDTOUSE="/usr/bin/unzip -p -a" which is coded. The command should allow for stdout. – chandra prakash Oct 29 '14 at 15:13
  • @chandraprakash Yes, what's missing? 7z should be in /usr/bin/7z – Volker Siegel Oct 29 '14 at 15:30
  • @Volker..Yup that available...but I need to know a command without pipeline or to save a file...is there any? – chandra prakash Oct 29 '14 at 15:32
  • @chandraprakash Sure, as I wrote, 7z e -so -bd file.zip - except that it does not work if you write to the terminal. I see, I did not make clear the the point with the terminal in the first section - is that the confusion? – Volker Siegel Oct 29 '14 at 15:36
  • @chandraprakash Let me know what your problem is - like the error message. What is wrong with COMMANDTOUSE="/usr/bin/7z e -so -bd? – Volker Siegel Oct 29 '14 at 15:37

The corresponding 7zip command is 7zip x -so that will extract your archive to the standard output stream.

| improve this answer | |
  • @ linkoff : please find the additional details in the questions – chandra prakash Oct 30 '14 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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