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 > Operating Systems > AIX
.
google unix.com



AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Sed Help in Updating something only in one particular file. bisla.yogender Shell Programming and Scripting 4 03-24-2008 11:48 AM
TO know whether file is updating or not raj333 Shell Programming and Scripting 2 11-05-2007 05:29 PM
Updating file in loop braindrain Shell Programming and Scripting 4 06-20-2007 01:37 PM
Why my sar is not updating the output file. skneeli UNIX for Advanced & Expert Users 1 11-12-2006 08:29 PM
sending and updating a file over network bhakti High Level Programming 1 09-21-2005 02:10 AM

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

Join Date: Feb 2006
Posts: 13
Updating a File in a Zip Archive

Hello everyone,

I have a script that pulls a text file out of a zip archive and updates the file. What I need to do is put it back in the zip archive and replace the old one, but I am having no luck.

Everything I search on forums or internet points to the command zip, that command is not available to me. Also this needs to be a zip archive that can be extracted using the unzip command.

Any help would be great.

Thanks,

DBridle
  #2 (permalink)  
Old 09-27-2006
hegemaro hegemaro is offline
Registered User
  
 

Join Date: Feb 2006
Location: Schenectady, NY
Posts: 134
Using InfoZip on Solaris 2.8, the -f (freshen) flag works like this:

Code:
$ unzip -Z archive.zip  
Archive:  archive.zip   918 bytes   4 files
-r--r--r--  2.2 unx     152 tx defN 27-Sep-06 14:15 file1
-r--r--r--  2.2 unx     152 tx defN 27-Sep-06 14:15 file2
-r--r--r--  2.2 unx     152 tx defN 27-Sep-06 14:15 file3
-r--r--r--  2.2 unx     152 tx defN 27-Sep-06 14:15 file4
4 files, 608 bytes uncompressed, 416 bytes compressed:  31.6%
$ /usr/ucb/lptest > file3
$ zip -f archive.zip file3
freshening: file3 (deflated 97%)
$ unzip -Z archive.zip    
Archive:  archive.zip   1255 bytes   4 files
-r--r--r--  2.2 unx     152 tx defN 27-Sep-06 14:15 file1
-r--r--r--  2.2 unx     152 tx defN 27-Sep-06 14:15 file2
-r--r--r--  2.2 unx   16000 tx defN 27-Sep-06 14:27 file3
-r--r--r--  2.2 unx     152 tx defN 27-Sep-06 14:15 file4
4 files, 16456 bytes uncompressed, 753 bytes compressed:  95.4%
  #3 (permalink)  
Old 09-27-2006
dbridle dbridle is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 13
Unfortunately the zip command from InfoZip is not available to me.
  #4 (permalink)  
Old 09-27-2006
hegemaro hegemaro is offline
Registered User
  
 

Join Date: Feb 2006
Location: Schenectady, NY
Posts: 134
I'm sorry, obviously I did not read carefully enough. Let me try again...You stated that you have a script that extracts a file from a ZIP archive. What command are you using to do this? Also, what OS are you using? I'd be very surprised if a UNIX zip package had an unzip command but no zip counterpart. I'd also be surprised if any zip package wasn't just InfoZip compiled for that OS.

Try running your unzip command with only a -v or -V for version information.
  #5 (permalink)  
Old 09-27-2006
dbridle dbridle is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 13
UnZip 5.40 of 28 November 1998, by Info-ZIP.

There is no zip counterpart to it that I can see. Please bare in mind that I work for a large financial corporation, so everything is fairly restrictive ;(
  #6 (permalink)  
Old 09-27-2006
hegemaro hegemaro is offline
Registered User
  
 

Join Date: Feb 2006
Location: Schenectady, NY
Posts: 134
Unfortunately, unzip is "out-going" only. Unlike its gzip cousin which uses the same executable for gzip, gunzip, and gzcat, Info-ZIP's zip command is an entirely different binary. So, without installing the zip command -- available from http://www.info-zip.org/Zip.html -- there is no way for you to freshen files in a ZIP archive.

I appreciate the nature of a restrictive environment, but if your management requires you to update ZIP archives, then they must allow you to use the necessary tools. That's always a fun sell.

Good luck.

Just for giggles, try scanning the system (this could take a while):

$ find / -local -type f -name zip
  #7 (permalink)  
Old 09-27-2006
dbridle dbridle is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 13
My unix admin group was being champs and installed zip, with the -f refresh option so I'm all set.

Thank you for your help in pointing me in the right direction!
Sponsored Links
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:02 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