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
p7zip(1)						      General Commands Manual							  p7zip(1)

NAME
p7zip - Wrapper on 7za, a 7-zip file archiver with high compression ratio SYNOPSIS
p7zip [-d] [-h|--help] [--] [file...] -h print this help -d decompress file -- treats all subsequent arguments as file names, even if they start with a dash DESCRIPTION
7-Zip is a file archiver with the highest compression ratio. The program supports 7z (that implements LZMA compression algorithm), ZIP, CAB, ARJ, GZIP, BZIP2, TAR, CPIO, RPM and DEB formats. Compression ratio in the new 7z format is 30-50% better than ratio in ZIP format. p7zip is a gzip-like CLI wrapper script for 7zip FUNCTION LETTERS
-d Decompress file -h, --help Print usage -- Treats all subsequent arguments as file names, even if they start with a dash SEE ALSO
7z(1), 7za(1), 7zr(1), bzip2(1), gzip(1), zip(1) AUTHOR
Written for Debian by Mohammed Adnene Trojette. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +--------------------+-----------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+-----------------+ |Availability | SUNWp7zip | +--------------------+-----------------+ |Interface Stability | Uncommitted | +--------------------+-----------------+ NOTES
Source for p7zip is available on http://opensolaris.org. Mohammed Adnene Trojette October 31 2004 p7zip(1)
All times are GMT -4. The time now is 05:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy