XML Awk : Urgent


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting XML Awk : Urgent
# 1  
Old 10-17-2008
XML Awk : Urgent

Hi All,

I am a beginner to Unix. So would really appreciate if people out here can help me out.

I have a XML file which has a element <NoteData> in which two values DBHA and DAKO.

I need to search these in all the XML files in a directory and if found in the XML file then replace the below location element value either with DBHA or DAKO as what is contained in the XML element <NoteData>.

I need to make sure that the value substituted happens only in the first Location element.

<?xml version="1.0" encoding="ISO-8859-1"?>
<XmlInterchange xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="XML Schema" Version="1"> <InterchangeInfo>
<Date>2008-10-17T07:17:40.5870000+02:00</Date>
<Source>
<EnterpriseCode>DFD</EnterpriseCode>
<CompanyCode>BRE</CompanyCode>
<OriginServer>DEV</OriginServer>
<LoginName>anker.hansen</LoginName>
<LoginUserEmailAddress>anker.hansen@dsv.com</LoginUserEmailAddress>
</Source>
<Target />
<EDIOrganisation EDICode="00010973" OwnerCode="00010973">
<OrganisationDetails>
<Name>DSV Air &amp; Sea GmbH LKW</Name>
<Location Country="Germany" City="Bremen">DEBRE</Location>
<Addresses>
<Address AddressType="MAIN">
<AddressLine1>Knowledge Center Seafreight</AddressLine1>
<AddressLine2>Schlachte 15-18</AddressLine2>
<AddressCode>Knowledge Center Seafreig</AddressCode>

Thanks & Regards
Karan
# 2  
Old 10-17-2008
Your example doesn't have <NoteData>....
# 3  
Old 10-17-2008
That element can be anywhere in the data
# 4  
Old 10-18-2008
This thread closed because OP opened another thread on same issue.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to add Xml tags to an existing xml using shell or awk?

Hi , I have a below xml: <ns:Body> <ns:result> <Date Month="June" Day="Monday:/> </ns:result> </ns:Body> i have a lookup abc.txtt text file with below details Month June July August Day Monday Tuesday Wednesday I need a output xml with below tags <ns:Body> <ns:result>... (2 Replies)
Discussion started by: Nevergivup
2 Replies

2. UNIX for Dummies Questions & Answers

Urgent - XML Attribute Remove

Hi I have got a XML file which has got content as follows: <FUNCall81110000 Tag="81110000" CallDate="25/08/11" CallTime="00:03:22" TotalUsageValue="30" MeasurementUnit="1"/> I want to remove TotalUsageValue="30" only and TotalUsageValue="XXXXX" here XXX can be any value. (1 Reply)
Discussion started by: muchyog
1 Replies

3. Shell Programming and Scripting

Read content between xml tags with awk, grep, awk or what ever...

Hello, I trying to extract text that is surrounded by xml-tags. I tried this cat tst.xml | egrep "<SERVER>.*</SERVER>" |sed -e "s/<SERVER>\(.*\)<\/SERVER>/\1/"|tr "|" " " which works perfect, if the start-tag and the end-tag are in the same line, e.g.: <tag1>Hello Linux-Users</tag1> ... (5 Replies)
Discussion started by: Sebi0815
5 Replies

4. UNIX for Dummies Questions & Answers

urgent help to convert xml to xsl or csv

Urgent help to transfer data from .xml to xl sheet where each attribute and value goes into seperate column.Please help me with the command.Please help Thanks Uma (9 Replies)
Discussion started by: umapearl
9 Replies

5. Shell Programming and Scripting

Urgent awk help !!

Hi All,I need to convert following field from a file L2578978CLC/576/116804 => L2578978CLC/00000576/00168304 i have to append Zeros in the third and fourth number after slash / in the above string (total length of number should be 8). means L2578978CLC/576/116804 should be converted to... (3 Replies)
Discussion started by: unknown123
3 Replies

6. Shell Programming and Scripting

Help Reading XML files in Python: Urgent

OK so my objective is to create a python program that will parse an XML file(input.xml), then the program will create an mxml(output.mxml) file. In the program (.py) i need to read between CDATA so that I would get an output the CDATA code in the input.xml INPUT.XML <!]> ... (2 Replies)
Discussion started by: dcfivesixfive
2 Replies

7. UNIX for Advanced & Expert Users

How to read an Xml record contained in a file--urgent

Hi I have an xml file which has multiple xml records.. I don't know how to read those records and pipe them to another shell command the file is like <abc>z<def>y<ghi>x........</ghi></def></abc> (1st record) <jkl>z<mno>y<pqr>x........</pqr></mno></jkl> (2nd record) Each record end... (4 Replies)
Discussion started by: aixjadoo
4 Replies

8. UNIX for Advanced & Expert Users

Shell script failing to read large Xml record-urgent critical help

Hi All, I have shell script running on AIX 5.3 box. It has 7 to 8 "sed" commands piped(|) together. It has a an Xml file as its input which has many records internally. There are certain record which which have more than hundered tags.The script is taking a huge amount of time more than 1.5 hrs... (10 Replies)
Discussion started by: aixjadoo
10 Replies

9. Shell Programming and Scripting

Help me for AWK URGENT

i have a record like 1,23423,4545,6767,89898,3434,121212,123123,322 2,23233,3434,4545,56566,rxrx,e344343,343434,3434 1,23223,336,78787,78787,654,6767677,6877989,7878 i want to check the $6 field if its start with any letters, i want to move this record to some other file and keep rest of... (2 Replies)
Discussion started by: readycpbala
2 Replies
Login or Register to Ask a Question