replacing files in an EAR file after extracting


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting replacing files in an EAR file after extracting
# 1  
replacing files in an EAR file after extracting

{Hello All,
Here is what I am trying to do:


I have an archive file: AppName.ear

Code:
jar -tvf AppName.ear
 60459 Thu May 01 09:29:36 EDT 2008 /SharedResources/Application/App.dat
 67542 Thu May 01 09:29:36 EDT 2008 JDBCConn/Application/App.dat
 14488 Thu May 01 09:29:36 EDT 2008 config.xml

what I am doing is, converting the ear file to a directory with files/dirs in the ear file in it, to under that directory.


Code:
EARFILE="AppName.ear"
DIRNAME="$EARFILE"
mv $EARFILE $EARFILE.tmp
unzip $EARFILE.tmp $DIRNAME

Code:
Output:
# ls -lrt AppName.ear
total 32
-rw-r--r--   1 root     other      14488 May  1 09:29 config.xml
drwxr-xr-x   3 root     other        512 May 21 14:25 SharedResources
drwxr-xr-x   3 root     other        512 May 21 14:25 JDBCConn

But the problem is, if an entry starts with / in the ear file(SharedResources), I have to create the directory as __SharedResources.

I am able to get till getting the entries of the ear file,
for i in `jar -tvf AppName.ear | awk {'print $8'}`; do echo $i; done

but how do I look for the files/dirs starting with / and replace it with __ ?

Thanks,
Chiru
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #181
Difficulty: Medium
The Macintosh project began in 1979 when Apple employee Jef Raskin envisioned an easy-to-use, low-cost computer for the average consumer.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to get CRC check sum of files in java EAR file without extracting .jar/.war files to disk.?

unzip -v gives CRC info of each file in a zip(in my case .EAR) file. # unzip -v my-application.ear Archive: my-application.ear Length Method Size Cmpr Date Time CRC-32 Name -------- ------ ------- ---- ---------- ----- -------- ---- 197981 Defl:N 183708 7%... (1 Reply)
Discussion started by: kchinnam
1 Replies

2. Shell Programming and Scripting

Help needed with a shell script for deploying ear file to a weblogic server using WLST

Hi, Please help me through a shell script to run from command prompt using WLST for the below purpose: Automation process: >Check the availability of an application. >Stops the EAR if it already exists in Weblogic Server >Undeploys/Delete the project (EAR file) >Deploys the new ear file... (2 Replies)
Discussion started by: Amulya
2 Replies

3. Shell Programming and Scripting

Replacing first word while extracting

Hello All, I am extracting a part of file. the file looks as follows USING CHARACTER SET UTF8 DEFINE JOB ( DEFINE SCHEMA Flat_File_Schema ( cntnt_id VARCHAR(10) ); DEFINE OPERATOR o_mload TYPE update SCHEMA * ATTRIBUTES ( VARCHAR TdpId = @TdpId (5 Replies)
Discussion started by: nnani
5 Replies

4. Shell Programming and Scripting

Finding/replacing strings in some files based on a file

Hi, We have a file (e.g. a .csv file, but could be any other format), with 2 columns: the old value and the new value. We need to modify all the files within the current directory (including subdirectories), so find and replace the contents found in the first column within the file, with the... (9 Replies)
Discussion started by: Talkabout
9 Replies

5. UNIX for Dummies Questions & Answers

Replacing a particular string in all files in folder and file contents

I need to replace all filesnames in a folder as well as its content from AK6 to AK11. Eg Folder has files AK6-Create.xml, AK6-system.py etc.. the files names as well as contents should be changes to AK9-Create.xml, AK9-system.py etc All files are xml and python scripts. ---------- Post... (0 Replies)
Discussion started by: Candid247
0 Replies

6. UNIX for Dummies Questions & Answers

Extracting specific files from a tar file in HP-UX

I have tried: tar -xfv mytarfile.tar archive/tabv/* tar -xfv mytarfile.tar --wildcards 'archive/tabv/*' tar -xf mytarfile.tar -v --wildcards 'archive/tabv/*' tar -xfv mytarfile.tar --wildcards --no-anchored 'archive/tabv/*' tar -xfv mytarfile.tar --wildcards `archive/tabv/*` and none... (5 Replies)
Discussion started by: zapper222
5 Replies

7. Shell Programming and Scripting

Unpack (extract) EAR / JAR files

i have about 30 .EAR files, every ear file have 1 .JAR file. so i need to extract .EAR files then extract .JAR files, and one important thing is that every archive must bee extracted to separate folder. i try with gzip, but when i extract 30 ear files i cant make separate folders.... (1 Reply)
Discussion started by: waso
1 Replies

8. AIX

checking the version revisions of a java file inside the ear using KSHELL in AIX.

consider on day1, in PVCS repository we have java files like a.java,b.java with version revision 1.0, through ANT build script we have compiled and created an ear,named c.ear in AIX build server.we have transfered this ear from build server to portal server through FTP using KSHELL. consider... (0 Replies)
Discussion started by: kareemaashik
0 Replies

9. Solaris

deploying .ear file Websphere

hi This may not be right question to ask on this forum, but I think people here can answer the question. Please give me details of steps/commands used in UNIX ( only command mode) for deploying an ear file on websphere. Thanks in advance, Ashish (2 Replies)
Discussion started by: ashish_uiit
2 Replies

10. UNIX for Dummies Questions & Answers

Is extracting specific files from a zip file possible?

If a zip file contains several zip files, but if the file names of the files needed are known, is there a variation of the unzip command that will allow those few (individual) files to be extracted? --- Example: Zip file name: zip.zip unzip -l zip.zip will display file01, file02, file03, etc.... (1 Reply)
Discussion started by: HLee1981
1 Replies

Featured Tech Videos