getting multiple xml tag


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting getting multiple xml tag
# 1  
Old 01-10-2006
getting multiple xml tag

sorry for the trouble......
i have this file that contains the following:
00:00:21 Queue key, Queue Name=[GMS_Q,jms/citos/gms/HssQueue]
00:00:21 Sending Message :<EXGC-EXGU xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<trans_id>EXGC</trans_id>
<sys_prefix>GSYS</sys_prefix>
<terminal_id>G33</terminal_id>
<lane_ts>7</lane_ts>
<version>A</version>
<sno>1136908779</sno>
<exit_dt>200601102359</exit_dt>
<gate>3</gate>
<lane>07</lane>
<opr_logon>PD$PRA </opr_logon>
<card_no>003797</card_no>
<nom_hlr_cr_no> </nom_hlr_cr_no>
<nom_pass_ind>Y</nom_pass_ind>
</EXGC-EXGU>

]
00:00:21 Sending Message :<ARGC-ARGU xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<trans_id>ARGC</trans_id>
<sys_prefix>GSYS</sys_prefix>
<terminal_id>G31</terminal_id>
<lane_ts>2</lane_ts>
<version>B</version>
<sno>1136908785</sno>
<ariv_dt>200601102359</ariv_dt>
<gate>3</gate>
<lane>02</lane>
<opr_logon>PD$SDI </opr_logon>
</ARGC-ARGU>


00:00:21 Msg send to Queue=[<ARGC-ARGU xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<trans_id>ARGC</trans_id>
<sys_prefix>GSYS</sys_prefix>
<terminal_id>G31</terminal_id>
<lane_ts>2</lane_ts>
<version>B</version>
<sno>1136908785</sno>
<ariv_dt>200601102359</ariv_dt>
</ARGC-ARGU>

00:00:31 weblogic server=t3://cng3wls8:80
00:00:31 Queue key, Queue Name=[GMS_Q,jms/citos/gms/HssQueue]
00:00:41 weblogic server=t3://cng3wls8:80
00:00:41 Queue key, Queue Name=[GMS_Q,jms/citos/gms/HssQueue]
00:00:41 Sending Message :<EXGC-EXGU xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<trans_id>EXGC</trans_id>
<sys_prefix>GSYS</sys_prefix>
<terminal_id>G33</terminal_id>
<lane_ts>8</lane_ts>
<version>A</version>
</EXGC-EXGU>

00:03:02 weblogic server=t3://cng3wls8:80
00:03:02 Queue key, Queue Name=[GMS_Q,jms/citos/gms/HssQueue]
00:03:12 weblogic server=t3://cng3wls8:80
00:03:12 Queue key, Queue Name=[GMS_Q,jms/citos/gms/HssQueue]
00:03:12 Sending Message :<pregate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<system_c>HPREGATE</system_c>
<trans_c>HSPG</trans_c>
<trans_dt>20060111000307</trans_dt>
<user_id_m></user_id_m>
<func_c>C</func_c>
<pm_n>XB 2062M</pm_n>
<chassis_type>45</chassis_type>
<chassis_ulw>00000</chassis_ulw>
<pager_n>94944694</pager_n>
</pregate>


its a very very huge set of data and here are a part of it. I need to get the bold text out and piped each into a text file.
well the sed codes i try out is this:
sed -e 's_^..:..:.. .*<pregate_<pregate_g' raw.txt > pregate.out
sed -e 's_^..:..:.. .*<EXGC-EXGU_<EXGC-EXGU_g' raw.txt > EXGC.out
sed -e 's_^..:..:.. .*<ARGC-ARGU_<ARGC-ARGU_g' raw.txt > ARGC-ARGU.out

but it doesnt works....
any idea?
# 2  
Old 01-10-2006
This works for me....
Code:
$ sed -e 's/^.*\(<EXGC-EXGU .*\)$/\1/' -n -e '/<EXGC-EXGU/,/<\/EXGC-EXGU>/ p' forevercalz.txt > exgc.out
$ sed -e 's/^.*\(<ARGC-ARGU .*\)$/\1/' -n -e '/<ARGC-ARGU/,/<\/ARGC-ARGU>/ p' forevercalz.txt > argc.out
$ sed -e 's/^.*\(<pregate .*\)$/\1/' -n -e '/<pregate/,/<\/pregate>/ p' forevercalz.txt > pregate.out

Cheers
ZB
# 3  
Old 01-10-2006
grep "<" filename | sed 's/.*:.*:.*<\(.*\)/<\1/g'
# 4  
Old 01-11-2006
thanks for the codes Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Grepping multiple XML tag results from XML file.

I want to write a one line script that outputs the result of multiple xml tags from a XML file. For example I have a XML file which has below XML tags in the file: <EMAIL>***</EMAIL> <CUSTOMER_ID>****</CUSTOMER_ID> <BRANDID>***</BRANDID> Now I want to grep the values of all these specified... (1 Reply)
Discussion started by: shubh752
1 Replies

2. Shell Programming and Scripting

Moving XML tag/contents after specific XML tag within same file

Hi Forum. I have an XML file with the following requirement to move the <AdditionalAccountHolders> tag and its content right after the <accountHolderName> tag within the same file but I'm not sure how to accomplish this through a Unix script. Any feedback will be greatly appreciated. ... (19 Replies)
Discussion started by: pchang
19 Replies

3. Shell Programming and Scripting

To search for a particular tag in xml and collate all similar tag values and display them count

I want to basically do the below thing. Suppose there is a tag called object1. I want to display an output for all similar tag values under heading of Object 1 and the count of the xmls. Please help File: <xml><object1>house</object1><object2>child</object2>... (9 Replies)
Discussion started by: srkmish
9 Replies

4. Shell Programming and Scripting

Creating multiple xml tag lines in a file

Hi All, Can someone tell me how can we create same xml tag lines based on the number of lines present in other file and replace the Name variable vaule present in other file. basically I have this xml line <typ:RequestKey NameType="RIC" Name="A1" Service="DDA"/> and say I... (4 Replies)
Discussion started by: Optimus81
4 Replies

5. Shell Programming and Scripting

XML Parse between to tag with upper tag

Hi Guys Here is my Input : <?xml version="1.0" encoding="UTF-8"?> <xn:MeContext id="01736"> <xn:VsDataContainer id="01736"> <xn:attributes> <xn:vsDataType>vsDataMeContext</xn:vsDataType> ... (12 Replies)
Discussion started by: pareshkp
12 Replies

6. Shell Programming and Scripting

Using shell command need to parse multiple nested tag value of a XML file

I have this XML file - <gp> <mms>1110012</mms> <tg>988</tg> <mm>LongTime</mm> <lv> <lkid>StartEle=ONE, Desti = Motion</lkid> <kk>12</kk> </lv> <lv> <lkid>StartEle=ONE, Source = Velocity</lkid> <kk>2</kk> </lv> <lv> ... (3 Replies)
Discussion started by: NeedASolution
3 Replies

7. Shell Programming and Scripting

How to add the multiple lines of xml tags before a particular xml tag in a file

Hi All, I'm stuck with adding multiple lines(irrespective of line number) to a file before a particular xml tag. Please help me. <A>testing_Location</A> <value>LA</value> <zone>US</zone> <B>Region</B> <value>Russia</value> <zone>Washington</zone> <C>Country</C>... (0 Replies)
Discussion started by: mjavalkar
0 Replies

8. Shell Programming and Scripting

How to retrieve the value from XML tag whose end tag is in next line

Hi All, Find the following code: <Universal>D38x82j1JJ </Universal> I want to retrieve the value of <Universal> tag as below: Please help me. (3 Replies)
Discussion started by: mjavalkar
3 Replies

9. Shell Programming and Scripting

Extract multiple xml tag value into CSV format

Hi All, Need your assistance on another xml tag related issue. I have a xml file as below: <INVOICES> <INVOICE> <BILL> <BILL_NO>1234</BILL_NO> <BILL_DATE>01 JAN 2011</BILL_DATE> </BILL> <NAMEINFO> <NAME>ABC</NAME> </NAMEINFO> </INVOICE> <INVOICE> <BILL> <BILL_NO>5678</BILL_NO>... (12 Replies)
Discussion started by: angshuman
12 Replies

10. Shell Programming and Scripting

XML tag replacement from different XML file

We have 2 XML file 1. ORIGINAL.xml file and 2. ATTRIBUTE.xml files, In the ORIGINAL.xml we need some modification as <resourceCode>431048</resourceCode>under <item type="Manufactured"> tag - we need to grab the 431048 value from tag and pass it to database table in unix shell script to find the... (0 Replies)
Discussion started by: balrajg
0 Replies
Login or Register to Ask a Question