The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
search for the contents in many file and print that file using shell script cdfd123 Shell Programming and Scripting 3 10-07-2007 10:17 PM
view contents of shared library naren_chella High Level Programming 4 05-26-2006 01:01 PM
Creating file contents using contents of another file ReV Shell Programming and Scripting 21 02-24-2006 10:25 AM
Reading specific contents from a file and appending it to another file dnicky Shell Programming and Scripting 5 10-04-2005 05:45 AM
Unable to view contents of a directory maddave UNIX for Dummies Questions & Answers 13 10-25-2001 01:50 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-13-2008
amitkhiare amitkhiare is offline
Registered User
  
 

Join Date: Feb 2006
Location: Hong Kong
Posts: 24
Exclamation How to view the contents of .gz file without extracting the file?

Hi All,

I have several .gz files and i need to see the contents of these file, without extracting these file. If i extract these file the space will be full so. I need to see the contents and parse the contents to a script to extract data from these.

Please let me know if you need any more information.

thanks and regards,
Amit
  #2 (permalink)  
Old 01-14-2008
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,513
try zcat , if you have it.
  #3 (permalink)  
Old 01-14-2008
amitkhiare amitkhiare is offline
Registered User
  
 

Join Date: Feb 2006
Location: Hong Kong
Posts: 24
zcat is used for compressed file. These are zip files. Also i dont wante to see the file name, but i need to read the zip file.

for example:-

the zip file is a.gz, however the orginial file inside is a.txt.

I want to see wht is there in a.txt and pipe it to another file and use that somewhere else.

Assumming the data in a.txt is 12368464,ffg,afasdffads,3243,dfdarf

so i need to know wht is in the a.txt

Hope now the requirement is clear.

Thanks,
amit
  #4 (permalink)  
Old 01-14-2008
amitkhiare amitkhiare is offline
Registered User
  
 

Join Date: Feb 2006
Location: Hong Kong
Posts: 24
FYI......

I got it sort

Command is : gzip -cd <file> | more
  #5 (permalink)  
Old 12-02-2008
sridharg sridharg is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 4
@ Command is : gzip -cd <file> | more
This command works in case of single file in the archive... if there are multiple files in archive rest of the file are skipped...

I get this message:

"gzip: test.zip has more than one entry--rest ignored"

Any suggestions to extract specific file from a zip archive with multiple files?
  #6 (permalink)  
Old 12-02-2008
pareshan pareshan is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 24
I think you simply can do
tar tf file_name

Coz i use tht for all .tgz (tar files) and it works
  #7 (permalink)  
Old 12-17-2008
tosattam tosattam is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 13
Hi I have a problem. I have a .GZ file say tosattam.GZ
If I unzip the file using winzip in windows the extract comes out as asd_123.txt
but when i am trying gunzip or gzip -d after bringing the file in UNIX I am getting tosattam as the extract from the same .GZ file. The one I am getting in windows is correct I know. But why am I not getting the same in UNIX??!!
totally confused
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:54 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0