getting requestName from xml outout in log file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting getting requestName from xml outout in log file
# 1  
Old 06-21-2011
getting requestName from xml outout in log file

hi all,
i was wondering if there is an easy and smart way of greping for requestname (in bold below) from xml output from application log file on a solaris 10 system.

The requestName is the actual method name which gets called e.g it could be 'getAccount' or getId or getAddress etc etc

example of output written to log file :

Code:
2011-06-22 07:11:02,372 [TP-Processor6] DEBUG aapt.obs.ws.ValidationHandler - <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://sch
emas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><requestName
xmlns="http://www.powertel.com.au/OrderBillingServices/xsd"><input>235234523</input></requestName></soapenv:Body></s
oapenv:Envelope>


i wanted to get this requestname so i can count how many times it occurs in the log file.

so far i have tried the below but i dont know how to get the requestName attribute.

Code:
grep -i "request" app.log



thanks in advance.
# 2  
Old 06-21-2011
Code:
% NAME=requestName;                                                         

% perl -0777 -lne 'print "$1\n" while m|(<'$NAME'.*?</'$NAME'>)|sg' testfile
<requestName
xmlns="http://www.powertel.com.au/OrderBillingServices/xsd"><input>235234523</input></requestName>

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Split xml file into multiple xml based on letterID

Hi All, We need to split a large xml into multiple valid xml with same header(2lines) and footer(last line) for N number of letterId. In the example below we have first 2 lines as header and last line as footer.(They need to be in each split xml file) Header: <?xml version="1.0"... (5 Replies)
Discussion started by: vx04
5 Replies

2. Shell Programming and Scripting

Comparing delta values of one xml file in other xml file

Hi All, I have two xml files. One is having below input <NameValuePair> <name>Daemon</name> <value>tcp:7474</value> </NameValuePair> <NameValuePair> <name>Network</name> <value></value> </NameValuePair> ... (2 Replies)
Discussion started by: sharsour
2 Replies

3. Shell Programming and Scripting

awk to indent file outout

i have a file that contains information such as this: hostname.sky.net === 12.39.59.35 hostname.sky.net === 12.39.59.35 hostname.sky.net === 12.39.59.35 hostname-newyork.sky.net ==== 13.45.35.24 hostname-newyork.sky.net ==== 13.45.35.24... (3 Replies)
Discussion started by: SkySmart
3 Replies

4. Shell Programming and Scripting

Help required in Splitting a xml file into multiple and appending it in another .xml file

HI All, I have to split a xml file into multiple xml files and append it in another .xml file. for example below is a sample xml and using shell script i have to split it into three xml files and append all the three xmls in a .xml file. Can some one help plz. eg: <?xml version="1.0"?>... (4 Replies)
Discussion started by: ganesan kulasek
4 Replies

5. 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

6. Shell Programming and Scripting

Replicating jobs, renaming outout

Can anyone tell me if it's possible to write a script that will repeat the same job several times but give the output a slightly different name each time (i.e. change or add a number at the end of the output file)? Here is the script I use to run a single job: #!/bin/bash #PBS -N job0 #PBS -l... (1 Reply)
Discussion started by: peterjb100
1 Replies

7. 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

8. Linux

Coverting a log file into XML

ID -------CODE-------DATE-------URL I have a log file with entries like this. The file has about 6 lakhs record and the size is about 42MB. I need to covert them into a XML file like <ID></ID> <CODE></CODE> <DATE></DATE> <URL></URL> I have done a logic for this and successfully done.... (0 Replies)
Discussion started by: arunkumar.in
0 Replies

9. 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

10. Shell Programming and Scripting

creating/using libraries Perl...blank outout?

Good morning!! Im trying to create a script that should get a list of numbers from the user (using STDIN or a list of arguments), and call my library function. #!use/bin/perl require 'my-lib.pl'; @userArray = <STDIN>; while() { chomp; last if ! /\d/; push(@userArray,&_); }... (2 Replies)
Discussion started by: bigben1220
2 Replies
Login or Register to Ask a Question