7z command for files larger than 4GB ( unzip doesn't work)


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers 7z command for files larger than 4GB ( unzip doesn't work)
# 8  
Old 11-05-2014
Thanks for your suggestion Junior helper. But the command 7z e -t zip filename.zip is not working. Please check below
Code:
<servername:/tmp>$ 7z e -t zip Test.zip
Error:
Incorrect command line


Last edited by Franklin52; 11-07-2014 at 07:03 AM.. Reason: Please use code tags
# 9  
Old 11-05-2014
Strange. Can you try 7z e DEX_DWH034.zip ?

It it fails too, maybe post the output of 7z --help.
This User Gave Thanks to junior-helper For This Post:
# 10  
Old 11-05-2014
Hi thanks for your command . It is useful. But I want the command for standard output (which shows the data in the command prompt while unzipping the file). same like as unzip -p -a . And the worst part is that I don't want to use any pipeline symbols ( for saving to a file and or using more or less eg : 7z -e filename | more)
# 11  
Old 11-05-2014
This could be the command you're after:
Code:
7z e -so filename.zip 2>/dev/null

---------- Post updated at 02:42 PM ---------- Previous update was at 02:40 PM ----------

2>/dev/null is required, otherwise 7z will complain:
Code:
Error:
I won't write data and program's messages to same terminal

This User Gave Thanks to junior-helper For This Post:
# 12  
Old 11-05-2014
Hi thanks .. it was helpful. Just a doubt. what is meant by 2>/dev/null Smilie

---------- Post updated at 07:49 AM ---------- Previous update was at 07:45 AM ----------

And how can I edit that in the code ?
# 13  
Old 11-05-2014
Quote:
Originally Posted by chandraprakash
what is meant by 2>/dev/null Smilie
> what is meant by 2>/dev/null

In this context, it's kind of difficult to explain, but I'll try. It has to do with "streams" produced by a program. When a program is executed, it can produce standard output (stdout on "channel" 1) or standard error (stderr on "channel" 2) or both at the same time. The streams are shown on the terminal.

When you run 7z e file.zip, it will print some output to stdout (7z program data).

When you run 7z e -so file.zip, 7z will try to write data content of the files in the zip archive to stdout due to the -so option. At the same time it is putting the 7z program data on stderr (this is how I interpret it, though). Still, both stdout and stderr are connected to the terminal, and that's why 7z would complain.

2>/dev/null will simply redirect the 7z's program data to "nowhere" and thus make the -so option possible. Of course you could redirect the program data to a file and see what's exactly in there. Use 2>somefile.txt to do that.

Read https://en.wikipedia.org/wiki/Standard_streams for further details on streams.

Quote:
Originally Posted by chandraprakash
And how can I edit that in the code ?
Fortunately, following syntax is possible too: 7z e -so 2>/dev/null filename.zip, so things don't get too complicated.

Code:
sed 's/\/usr\/bin\/unzip -p -a/7z e -so 2>\/dev\/null/' codefile

If it works on the terminal, try following to perform the actual edit:
Code:
sed -i 's/\/usr\/bin\/unzip -p -a/7z e -so 2>\/dev\/null/' codefile

Hope this helps.
This User Gave Thanks to junior-helper For This Post:
# 14  
Old 11-05-2014
Quote:
Originally Posted by chandraprakash
Thanks for your suggestion Junior helper. But the command 7z e -t zip filename.zip is not working. Please check below


<servername:/tmp>$ 7z e -t zip Test.zip
Error:
Incorrect command line
That error occurred because there was a space between the -t and the zip, there should be none.
Code:
7z e -tzip Test.zip

Also, 7z will give you an exit code that might be helpful on what failed. You view that exit code by echo $? after the command is issued

Last edited by Aia; 11-05-2014 at 01:48 PM..
This User Gave Thanks to Aia For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Backingup larger files with TAR command

I need to backup my database but the files are very large and the TAR command will not let me. I searched aids and found that I could do something with the mknod, COMPRESS and TAR command using them together. I appreciate your help. (10 Replies)
Discussion started by: frizcala
10 Replies

2. Shell Programming and Scripting

Ssh remote command doesn't work from script file

I have 10 application servers in a distributed architecture generating their own application logs. Each server has application utility to continuously tail the log. for example following command follows tails and follows new logfiles as they are generated server1$ logutility logtype When I run... (8 Replies)
Discussion started by: indianya
8 Replies

3. Shell Programming and Scripting

Single command - unzip files from a tar command

I have a tar file that contains multiple .Z files. Hence I need to issue a tar command followed by a gzip command to fully extract the files. How do I do it in a single command? What I'm doing now is tar xvf a.tar (this will output 1.Z and 2.Z) gzip -d *.Z (to extract 1.Z and 2.Z) (9 Replies)
Discussion started by: ericlim
9 Replies

4. Solaris

Mount command doesn't work on Solaris System

Hi All, I am using a solaris Sun-Fire-V440 server. The OS is solaris. My problem is whenever I run the command mount | grep "^/ " | sed -e 's,^.*dsk/\(*\).*$,\1,' it should return a disk value as "d30" as it does on each of my other servers.But on this server I am not getting any o/p from... (3 Replies)
Discussion started by: vivek.goel.piet
3 Replies

5. Shell Programming and Scripting

sed command works on Fedora/Ubuntu, but doesn't work in Mac

Hi, I have a question. I define a function using sed command: replace() { searchterm=$1 replaceterm=$2 sed -e "s/$searchterm/$replaceterm/ig" $3 > $WORK'tempfile.tmp' mv $WORK'tempfile.tmp' $3 } Then I call replace 'test = 0' 'test = 1' $myfile This code... (1 Reply)
Discussion started by: Dark2Bright
1 Replies

6. Shell Programming and Scripting

sed command works on Fedora/Ubuntu, but doesn't work in Mac

Hi, I have a question. I define a function using sed command: replace() { searchterm=$1 replaceterm=$2 sed -e "s/$searchterm/$replaceterm/ig" $3 > $WORK'tempfile.tmp' mv $WORK'tempfile.tmp' $3 } Then I call replace 'test = 0' 'test = 1' $myfileThis code works well in... (1 Reply)
Discussion started by: Dark2Bright
1 Replies

7. UNIX for Dummies Questions & Answers

find command in shell script doesn't work

Hello all, Something strange going on with a shell script I'm writing. It's trying to write a list of files that it finds in a given directory to another file. But I also have a skip list so matching files that are in that skip list should be, well uhm, skipped :) Here's the code of my... (2 Replies)
Discussion started by: StijnV
2 Replies

8. Shell Programming and Scripting

cd command doesn't work through variables

Hi.... cd command is not working when dual string drive/volume name is passed to cd through variables....... For Ex.... y=/Volumes/Backup\ vipin/ cd $y the above command gives error....... anyone with a genuine solution ? (16 Replies)
Discussion started by: vipinchauhan222
16 Replies

9. Shell Programming and Scripting

Command doesn't work under cron ?

I have defined in cron crontab -l >/FIXENGINE/data/crontab.$(whoami).$(date +%a) The resulting file is named crontab.fixadmin. When I run the above from a command line, the file is named: crontab.fixadmin.Tue (or whatever day I happen to be running) The question is - why do I get... (4 Replies)
Discussion started by: bigjohn-nj
4 Replies

10. Shell Programming and Scripting

command line work script doesn't

Hello, I'm stuck and confused as to why when I execute things form the command line it works but when in a script it doesn't. My script: ### creating a lock on the console touch /var/run/console.lock chmod 600 /var/run/console.lock echo "$User" >>... (2 Replies)
Discussion started by: larry
2 Replies
Login or Register to Ask a Question