Computing.Net > Forums > Unix > how to replace a file in a .zip fil

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

how to replace a file in a .zip fil

Reply to Message Icon

Name: arun_s010
Date: July 28, 2006 at 00:21:00 Pacific
OS: AIX5.3
CPU/Ram: 1GB
Product: IBM
Comment:

i want to replace a file in .zip file in AIX5.3 machine;

say i have file script.ksh file and a build.zip file which contains older version of script.ksh. i dont want to zip the entire thing. i want to replace newer version of script.ksh to build.zip file. please let me know how to do that. its bit urgent.

thanks in advance
Arun S



Sponsored Link
Ads by Google

Response Number 1
Name: lchi2000g
Date: July 28, 2006 at 06:30:46 Pacific
Reply:

Example:

/home/oracle/luke/tmp$ ll test.zip
-rw-r--r-- 1 oracle oinstall 2619 Jul 28 08:10 test.zip

/home/oracle/luke/tmp$ unzip -l test.zip
Archive: test.zip
Length Date Time Name
-------- ---- ---- ----
48 07-27-06 12:03 1.sh
487 07-28-06 08:10 2.sh
255 07-27-06 13:55 3.sh
264 07-27-06 12:09 file
405 07-27-06 13:29 file1
90 07-27-06 12:18 file2
18 07-08-06 01:17 in
4139 06-27-06 11:18 rep
-------- -------
5706 8 files

(Then, modifidy 2.sh file)
/home/oracle/luke/tmp$ echo 999 > 2.sh

/home/oracle/luke/tmp$ cat 2.sh
999

(replace the old 2.sh in test.zip with the new 2.sh)
/home/oracle/luke/tmp$ zip -u test.zip 2.sh
updating: 2.sh (stored 0%)

/home/oracle/luke/tmp$ unzip -l test.zip
Archive: test.zip
Length Date Time Name
-------- ---- ---- ----
48 07-27-06 12:03 1.sh
4 07-28-06 08:14 2.sh <== the time changed
255 07-27-06 13:55 3.sh
264 07-27-06 12:09 file
405 07-27-06 13:29 file1
90 07-27-06 12:18 file2
18 07-08-06 01:17 in
4139 06-27-06 11:18 rep
-------- -------
5223 8 files

/home/oracle/luke/tmp$ echo 888 > 2.sh
/home/oracle/luke/tmp$ cat 2.sh
888

(extract 2.sh from test.zip)
/home/oracle/luke/tmp$ unzip test.zip 2.sh
Archive: test.zip
replace 2.sh? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
extracting: 2.sh

(2.sh in test.zip was extracted)
/home/oracle/luke/tmp$ cat 2.sh
999

Luke Chi


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: how to replace a file in a .zip fil

how to replace a line in a file www.computing.net/answers/unix/how-to-replace-a-line-in-a-file/7214.html

how to read a file www.computing.net/answers/unix/how-to-read-a-file/8202.html

How to write a korn shell script www.computing.net/answers/unix/how-to-write-a-korn-shell-script/3643.html