Sponsored Content
Top Forums UNIX for Dummies Questions & Answers 7z command for files larger than 4GB ( unzip doesn't work) Post 302923930 by junior-helper on Wednesday 5th of November 2014 08:41:24 AM
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:
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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' $myfileThis code works well in... (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' $myfile This code... (1 Reply)
Discussion started by: Dark2Bright
1 Replies

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

8. 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

9. 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

10. 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
All times are GMT -4. The time now is 10:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy