f



How to view a text file within a zip file without extracting it ?

Hi ,

How do i view the contents of text file within a zip file without 
extracting it ?
My requirement is that there are several zip files having a version
file within them ( which is text file ) . I just want to find the zip 
file with the exact version ( by reading the version file within the zip 
) and then unzip it ?
I have access to xterm and cannot use the Archiver in KDE for example.

Thanks,
Prakash

0
Prakash
10/30/2003 11:23:22 AM
comp.os.linux.development.apps 5216 articles. 1 followers. Post Follow

2 Replies
3548 Views

Similar Articles

[PageSpeed] 18

Prakash Prabhu wrote:
> =

> Hi ,
> =

> How do i view the contents of text file within a zip file without
> extracting it ?
> My requirement is that there are several zip files having a version
> file within them ( which is text file ) . I just want to find the zip
> file with the exact version ( by reading the version file within the zi=
p
> ) and then unzip it ?
> I have access to xterm and cannot use the Archiver in KDE for example.

You might try "strings" on the ZIP archive, if the text file is not
compressed in some way. If it is, then the only way is to extract the
file (i.e. uncompress it) and then check its contents.

-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett
0
Josef
10/30/2003 11:47:21 AM
Prakash Prabhu wrote:
> Hi ,
> 
> How do i view the contents of text file within a zip file without 
> extracting it ?
> My requirement is that there are several zip files having a version
> file within them ( which is text file ) . I just want to find the zip 
> file with the exact version ( by reading the version file within the zip 
> ) and then unzip it ?
> I have access to xterm and cannot use the Archiver in KDE for example.
> 
> Thanks,
> Prakash
> 
I think that you are looking for a feature simmilar to the view option 
available in winzip or other graphical zip utilities.  Most graphical 
file browsers are capable of this feature under linux.  If however you 
are looking for this featue in a command line sort of tool, then you 
have a little work to do, as the graphical tools implement this by 
actually extracting the file, piping it into a viewer, and removing it 
when its closed.  You may be able to get the same function out of 
wrapping a script around the utility that you want.  Perhaps something 
like the following:
--------------------------------------------
#!/bin/sh

#Alias the command line args
ZIPFILE=$1
TEMPFILE=$2

#extract the file from the zip archive
unzip $ZIPFILE $TEMPFILE

#pump it into a viewer
vi $TEMPFILE

#now remove the requested file
rm $TEMPFILE
---------------------------------------------

Of course this only works on files you can read in vi, but you could 
easily extend it to other file types.

HTH
Neil


-- 
/***************************************************
  *Neil Horman
  *Software Engineer
  *Red Hat, Inc., www.redhat.com
  *gpg keyid: 1024D / 0x92A74FA1
  *http://www.keyserver.net
  ***************************************************/

0
Neil
10/30/2003 1:19:58 PM
Reply: