serach and replace file name in the path in a remote xml file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting serach and replace file name in the path in a remote xml file
# 1  
Old 11-12-2007
serach and replace file name in the path in a remote xml file

hi every one ,

here is my problem !!

i have to run my script from an account and update the result in a xml file located on a different account. i use existing ssh keys to do it remotely

for example the tags looks like this


<PropertyValueList DeploymentName="Generic" NodeName="Generic" AppServerName="Generic">

<PropertyValue PropertyName="ProductCatalogBinaryFile">
<Value>/app/tsa/tsausr1_wb154/tsa/oms/ete3oms/OMSTSA_v06.00_1/OMS/pcdump/PcDump_06Nov_MAX_FT_80008.bin</Value>


i need to serach the PcDump_06Nov_MAX_FT_80008.bin file and update with the new filename, am having with me say for example PcDump_10Nov_MAX_FT_80008.bin

but the catch is ,
the absolute path mentioned above changes from one account to another , and also the file names
the file name pattern is same in every account like this PcDump_xxxxx_MAX_FT_xxxxxx.bin

Smilie thanks in advance

Last edited by kiranreddy1215; 11-12-2007 at 09:30 AM..
# 2  
Old 11-12-2007
Something like
sed 's|/PcDump_[0-9][0-9][A-Z][a-z][a-z]_MAX_FT_[[0-9][0-9][0-9][0-9][0-9].bin|/PcDump_10Nov_MAX_FT_80008.bin|g' <input xml>

Wouldn't it be easier to cp the PCDump*.txt file to a standard input file name, and code for that name permanently?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace a string in a xml file

Hello, I have below xml file, I want to find line default-value and replace the string within quotes followed by default-value "moni/Websphere/". Replace moni/Websphere/ with monitor/AMQ/ <monitor> <name>WebsphereMqMonitor</name> <type>managed</type> <argument... (4 Replies)
Discussion started by: prince1987
4 Replies

2. Shell Programming and Scripting

Replace the .txt file between two strings in XML file

Hi i am having XML file with many number of lines,I need to replace between two strings with .txt file using awk. For ex <PersonInfoShipTo ------------------------------ /> My requirement is to replace the content between <PersonInfoShipTo ------------------------------ /> help me. Thanks... (9 Replies)
Discussion started by: Padmanabhan
9 Replies

3. Shell Programming and Scripting

Need to replace particular content in a xml file

Hi, My requirement is to find a text and replace it with another in a XML file. I am new to Unix,Please provide some suggestion to achieve. Find: <Style ss:ID="ColumnHeader1"> Replace with: <Style ss:ID="ColumnHeader1"> <Borders> <Border ss:Position="Bottom"... (4 Replies)
Discussion started by: cnraja
4 Replies

4. Shell Programming and Scripting

Find/Replace in XML file

I am not sure how to approach this find/replace using a shell script. Any help or guidance appreciated. I want to find this: <objects/> <thumb>thumb_0001.jpg</thumb> <preview>preview_0001.jpg</preview> And replace with something like this: <objects>... (1 Reply)
Discussion started by: jimraynor
1 Replies

5. UNIX for Dummies Questions & Answers

replace %20 in xml file

Hi, I'd like to use sed in order to replace %20 and other "special" characters that are represented with % and some number combination in xml file. Typical line looks like this: /Users/imac1/Music/iTunes/iTunes... (6 Replies)
Discussion started by: andrejm
6 Replies

6. Shell Programming and Scripting

Search and replace in xml file using awk..

Hi All, I have xml file,i am tring to use awk to search pattern as: <Password>x</Password> and Replace with: <Password>y</Password> please any one can help to solve this using awk and awk only. (4 Replies)
Discussion started by: islam2666
4 Replies

7. Shell Programming and Scripting

serach and replace a specific pattern or value in a xml file

can some one help me with a perl command i have to search and replace a version from a xml-file so i use in a ksh script a command like this ssh $GLB_ACC@$GLB_HOST "/usr/contrib/bin/perl -pi -e "s/$curVersion/$new_Version/g" $Dest_dir/epi.xml" this command worked so far, but the problem... (1 Reply)
Discussion started by: kiranreddy1215
1 Replies

8. Shell Programming and Scripting

replace nth value in xml file

Hi all, I have application.xml file with following content <dependency> <groupId>fr.orange.portail.ear</groupId> <artifactId>_AdminServicesEAR</artifactId> <version>1.0.0-20080521.085352-1</version> <type>ear</type> </dependency> <dependency> ... (4 Replies)
Discussion started by: subin_bala
4 Replies

9. Shell Programming and Scripting

Replace path in a file with dot

Hi, I have a file with below values. /uvxapps/etl/Ascential/DataStage/DSEngine/dsenv.orig /uvxapps/etl/Ascential/DataStage/DSEngine/dsenv /uvxapps/etl/Ascential/DataStage/DSEngine/sample/.cshrc /uvxapps/etl/Ascential/DataStage/DSEngine/sample/.login... (3 Replies)
Discussion started by: njoshi
3 Replies

10. Shell Programming and Scripting

Replace a Directory path with another in a file

Hi, I have abt 20-30 scripts using a directory structure. I have to replace a directory structure in a file for example "/i01/proc" with "/dwftp/scripts" using sed. The command :- cat filename | sed 's/"i01/proc"/"dwftp/scripts"' is not working. Can someone help me in this regard? ... (3 Replies)
Discussion started by: venkatajay_18
3 Replies
Login or Register to Ask a Question