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

try zcat , if you have it.

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

FYI......

I got it sort

Command is : gzip -cd <file> | more

@ 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?

I think you simply can do
tar tf file_name

Coz i use tht for all .tgz (tar files) and it works

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

simply give the below command !

gunzip -c file1.gz

Sorry ali that wont solve my prob coz that will write the file in standard output. As I have already said i want to extract the actual file that was zipped rather than the same file with different name(as the name of the zipped file).

use the following command
gzcat filename.gz | more

Thank you all. I have got the command.. My problem was solved with gzip -N xxx.GZand the extracted file name was aaa.txt.