Sponsored Content
Full Discussion: Help with gunzip
Top Forums Shell Programming and Scripting Help with gunzip Post 302427254 by drl on Friday 4th of June 2010 10:41:18 AM
Old 06-04-2010
Hi.

If you are comfortable downloading programs, p7zip may be of interest to you. In almost all *nix systems you can have local programs -- in your HOME directory structure -- you do not need to install them in system areas.

Here's an example of creation of a zip file and extraction with p7zip (for me, p7zip was in my Debian repository):
Code:
#!/usr/bin/env bash

# @(#) s1	Demonstrate uncompress, extract of zip archive with p7zip.
# 7zip: http://p7zip.sourceforge.net/

pe() { for i;do printf "%s" "$i";done; printf "\n"; }
pl() { pe;pe "-----" ;pe "$*"; }

rm -f t1 t2 t1.zip
FILE=${1-data1}

pl " Data file $FILE:"
head -20 $FILE

pl " Created zip file:"
cp $FILE t1
zip t1.zip t1
file t1.zip
ls -lgG t1 t1.zip

pl " Unzip with 7z:"
7z e -so t1.zip > t2
ls -lgG t2

pl " Compare files:"
if cmp --quiet t1 t2
then
  pe " Files have identical content."
else
  pe " Files differ, details:"
  diff t1 t2
fi

exit 0

producing:
Code:
% ./s1

-----
 Data file data1:
Albuquerque, N.M.
Arlington, Texas
Atlanta, Ga.
Austin, Tex.
Baltimore, Md.
Boston, Mass.
Charlotte, N.C.
Chicago, Ill.
Cleveland, Ohio
Colorado Springs, Colo.

-----
 Created zip file:
  adding: t1 (deflated 21%)
t1.zip: Zip archive data, at least v2.0 to extract
-rw-r--r-- 1 160 Jun  4 09:37 t1
-rw-r--r-- 1 262 Jun  4 09:37 t1.zip

-----
 Unzip with 7z:

7-Zip  4.58 beta  Copyright (c) 1999-2008 Igor Pavlov  2008-05-05
p7zip Version 4.58 (locale=C,Utf16=off,HugeFiles=on,1 CPU)

Processing archive: t1.zip

Extracting  t1

Everything is Ok

Size:       160
Compressed: 262
-rw-r--r-- 1 160 Jun  4 09:37 t2

-----
 Compare files:
 Files have identical content.

See the sourceforge URL noted in the script. Best wishes ... cheers, drl
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

gunzip....problem

Hi........... i have downloaded...sunscreen3.1 lite frm sunfreeware .com and it is in tar.gz format..so i download gzip also... now pls tell me how to install gzip and how to unzip tht sunscreen tar.gz file..............after unzipping i have to untar the tar file or not.....pls tell me in... (2 Replies)
Discussion started by: Prafulla
2 Replies

2. UNIX for Dummies Questions & Answers

Gunzip

Hi can't unzip a gz file in TurboLinux 7.0 when i'm trying this gunzip filename.tar.gz it always says not in gzip format what should I do...please help me (4 Replies)
Discussion started by: CreamHarry
4 Replies

3. UNIX for Dummies Questions & Answers

gunzip question

unzip test.zip ==> This uncompresses and keeps the original zip file. gunzip test.gz ==> Removes the .gz file after uncompressing. Is there any switch to make the .gz file available after uncompression. Thanx in advance. (3 Replies)
Discussion started by: devs
3 Replies

4. UNIX for Dummies Questions & Answers

gunzip syntax help

Hi All, I am a newbie to unix and need help. I am trying to unzip the files in source library to destination library. the input filename can be any thing with abc and after unzip, i want the same file name with original extension suppose,the input file is ABC_jun25.dat.gz after gunzip in the... (1 Reply)
Discussion started by: onlyjayaram
1 Replies

5. Shell Programming and Scripting

Help on gunzip

Hi All, I am using UNIX command to unzip the files gzip -d9 DW_*.gz The Xmls are compressed using gzip and it is received in the .gz format at UNIX box which need to be uncompressed. The above command is working fine for 400 compressed xmls(.gz files) but when the count becomes 401 or more i... (7 Replies)
Discussion started by: Codesearcher
7 Replies

6. UNIX for Dummies Questions & Answers

gunzip

I have a zip file as a.zip and it contains 1m xml files. like a1.xml, a2.xml.... The size is also very big nearly 1GB. I want to extract only a123.xml. Can any one help how can I do this? (1 Reply)
Discussion started by: siba.s.nayak
1 Replies

7. Shell Programming and Scripting

Gunzip files

Hello Everyone, I have a few files in a directory such as : abc.xyz.txt1.gz abc.xyz.txt2.gz .... .... ... ... abd.xyz.txt100.gz And I want uncompressed files such as: abc.xyz.txt1 abc.xyz.txt2 .... ... ..... .... (1 Reply)
Discussion started by: ad23
1 Replies

8. SCO

gunzip problem

hi On one of our SCO 5.0.6 server gunzip doesn't work and I'm getting this error message: # gunzip dynamic linker: gunzip: symbol not found: ___requires_updated_system_library_se_ Killed What's missing? (0 Replies)
Discussion started by: ccc
0 Replies

9. Shell Programming and Scripting

Gunzip files

Hi ALL, Am working with the gunzip command to zip all the old files having 10 days am using the command find . -name '*.log' -type f -mtime +10 -exec gunzip {} \; am facing two issues 1.)it displays the files which are all older than a year 2.)when am trying to gunzip all the... (2 Replies)
Discussion started by: thelakbe
2 Replies

10. Shell Programming and Scripting

gunzip status

Hi, I'm trying to run my application on HP-UX server. I have to extract a *.tar.gz file. I'm doing that now in 2 steps. first I gunzip it and then pax it. My question is how can I check whether the data in the *.tar.gz file is corrupted or not?? Now, I'm trying to do this... (1 Reply)
Discussion started by: Kyaw Lwin Phyo
1 Replies
ZIPMERGE(1)						      General Commands Manual						       ZIPMERGE(1)

NAME
zipmerge - merge zip archives SYNOPSIS
zipmerge [-DhIiSsV] target-zip source-zip Op source-zip ... DESCRIPTION
zipmerge merges the source zip archives source-zip into the target zip archive target-zip. By default, files in the source zip archives overwrite existing files of the same name in the target zip archive. Supported options: -D Ignore directory components in file name comparisons. -h Display a short help message and exit. -I Ignore case in file name comparisons -i Ask before overwriting files. See also -s. -S Do not overwrite files that have the same size and CRC32 in both the source and target archives. -s When -i is given, do not before overwriting files that have the same size and CRC32. -V Display version information and exit. EXIT STATUS
zipmerge exits 0 on success and 1 if an error occurred. SEE ALSO
zipcmp(1), ziptorrent(1), libzip(3) AUTHORS
Dieter Baron <dillo@giga.or.at> and Thomas Klausner <tk@giga.or.at> NiH June 4, 2008 ZIPMERGE(1)
All times are GMT -4. The time now is 11:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy