Need to extract XML message from log


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need to extract XML message from log
# 1  
Old 07-04-2008
Need to extract XML message from log

I need help to extract a following SOAP-ENV:Header XML message from the log.

XML message need to be extracted:
***************************

<SOAP-ENV:Header>
<ServiceGatewayHeader>
<SourceApplicationId>OXL</SourceApplicationId>
<Version>1.0</Version>
<UserId>TEST</UserId>
<DatetimeStamp>20-09-06 12:00:00</DatetimeStamp>
<Severity>NONE</Severity>
</ServiceGatewayHeader>
</SOAP-ENV:Header>

Log:

INFO 2008-07-04 10:39:35 @main [46] com.sigma.jea.call.CallFactory> search node ./condition under /#document/jea/taskTypes/taskType/function_body/assign
INFO 2008-07-04 10:39:35 @main [46] com.sigma.jea.call.CallFactory> add stmt:complete_envelope = join('<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelop
e/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:m0="java:
com.sprint.webservice.voiceoverip.helpers" xmlns:m1="java:com.sprint.webservice.voiceoverip.common" xmlns:m2="http://tempuri.org/GeneralLNP/GeneralLNP">
DEBUG 2008-07-04 10:39:35 @main [36] com.sigma.jea.call.CallFunc> type of header in sprint_voip_query_csr=string

<SOAP-ENV:Header>
<ServiceGatewayHeader>
<SourceApplicationId>OXL</SourceApplicationId>
<Version>1.0</Version>
<UserId>TEST</UserId>
<DatetimeStamp>20-09-06 12:00:00</DatetimeStamp>
<Severity>NONE</Severity>
</ServiceGatewayHeader>
</SOAP-ENV:Header>

INFO 2008-07-04 10:39:35 @main [46] com.sigma.jea.call.CallFactory> search node ./condition under /#document/jea/taskTypes/taskType/function_body/assign
DEBUG 2008-07-04 10:39:35 @main [36] com.sigma.jea.call.CallFunc> type of header in sprint_voip_query_csr=string
INFO 2008-07-04 10:39:35 @main [46] com.sigma.jea.call.CallFactory> add stmt:complete_envelope = join('<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelop
e/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:m0="java:
com.sprint.webservice.voiceoverip.helpers" xmlns:m1="java:com.sprint.webservice.voiceoverip.common" xmlns:m2="http://tempuri.org/GeneralLNP/GeneralLNP">

Last edited by tjshankar; 07-04-2008 at 03:08 PM..
# 2  
Old 07-04-2008
You need to provide more information if you want help from this forum
# 3  
Old 12-09-2008
i found a way to extract from log by using sed command as below:

cat abc.log | sed -n '/<SOAP-ENV:Header/,/<\/SOAP-ENV:Header/p'
# 4  
Old 12-09-2008
don't use cat when you are using sed,awk or grep they can take file as an input!!!
# 5  
Old 12-09-2008
What vidyadhar85 means is that you can eliminate the use of "cat" by doing the following:
Code:
sed -n '/<SOAP-ENV:Header/,/<\/SOAP-ENV:Header/p'  abc.log

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extract strings from XML files and create a new XML

Hello everybody, I have a double mission with some XML files, which is pretty challenging for my actual beginner UNIX knowledge. I need to extract some strings from multiple XML files and create a new XML file with the searched strings.. The original XML files contain the source code for... (12 Replies)
Discussion started by: milano.churchil
12 Replies

2. Shell Programming and Scripting

Extract a particular xml only from an xml jar file

Hi..need help on how to extract a particular xml file only from an xml jar file... thanks! (2 Replies)
Discussion started by: qwerty000
2 Replies

3. Shell Programming and Scripting

Taking error message from XML file, amending to script

Hello all, I have a question about creating a script that will look for messages on one of our MQ series systems, and fix them. Currently, if we issue a command for example Command.sh errors it gives us: ID:c3e2d840d4f3f3d74040404040404040cb2ef4e62f70f702 <?xml version="1.0"... (3 Replies)
Discussion started by: jeffs42885
3 Replies

4. Programming

[XQuery] How to Convert from JSON Message to XML Message with XQuery

Hi guys, I'm in a job of converting a restful webservice to soap. Tool for convertation uses XQuery. Now i need to convert a message like this: { "firstName": "John", "midName": null, "lastName": "Smith", "married": false, "address": { "streetAddress": "21 2nd... (5 Replies)
Discussion started by: tien86
5 Replies

5. Shell Programming and Scripting

Extract XML message from a log file using awk

Dear all I have a log file and the content like this file name: temp.log <?xml version="1.0" encoding="cp850"?> <!DOCTYPE aaabbb SYSTEM '/dtdpath'> <aaabbb> <tranDtl> <msgId>000001</msgId> </tranDtl> ..... </aaabbb> ... ... (1 Reply)
Discussion started by: on9west
1 Replies

6. Shell Programming and Scripting

Data Extract from XML Log File

Please help me out to extract the Data from the XML Log files. So here is the data ERROR|2010-08-26 00:05:52,958|SERIAL_ID=128279996|ST=2010-08-2600:05:52|DEVICE=113.2.21.12:601|TYPE=TransactionLog... (9 Replies)
Discussion started by: raghunsi
9 Replies

7. UNIX for Dummies Questions & Answers

Unable to extract a tag from a very long XML message

Hi I have a log file which contain XML message. I want to extract the value between the tag : <businessEventId>13201330</businessEventId> i.e., 13201330. I tried the following commands but as the message is very long, unable to do it. Attached is the log file. Please provide inputs. --... (3 Replies)
Discussion started by: Sapna_Sai
3 Replies

8. Shell Programming and Scripting

Move xml files from unix to message queue.

Hi, I need to move the XML files from the UNIX to the message queue. Please help me out to write the code.. Thanks, Mohana Krishnan (0 Replies)
Discussion started by: krishnan_6015@y
0 Replies

9. AIX

Move Xml files from AIX machine to message queue.

Hi, Im new to message queue... I need to move the xml files from the AIX server to the message queue. Please help me out to write the code.. Thanks, Mohana Krishnan (0 Replies)
Discussion started by: krishnan_6015@y
0 Replies

10. Shell Programming and Scripting

extract message

thx thx (1 Reply)
Discussion started by: ust
1 Replies
Login or Register to Ask a Question