Dear community,
I have a big XML log file containing several rows splitted by tag: <ActivityLogRecord> and </ActivityLogRecord>. An example below.
What I need is read the file and extract some value from each tags and put them into one line (each line for every <ActivityLogRecord> tag).
So in the example the output should be:
The problem where I'm scratching my head is that sometimes this field is missing: <WhoCalledOn>true</WhoCalledOn> and this could be reported twice, something like:
This means the output I need should be:
In other words, if the tag WhoCalledOn is missing, I should report in output something like NULL, otherwise put the value like true o false. Same thing for the TelephoneNumber tag. If reported only one, the second column should be set as NULL, otherwise report the value.
Well, I know, this is not properly simple, that's why I'm asking to the expert!
Not sure I understand. Looking at your sample, I can't see WHAT should be reported twice. And, is "COSID=" a constant present in all records that can be searched for, or part of the <common> tag?
Well, first of all thanks for reply, what I need is the 3 red value in my previous example.
As I wrote COSID and TelephoneNumber is always present
In some case <WhoCalledOn> is not present so in the ouput should be reported NULL. In other cases TelephoneNumber rows is reported twice, so output I need is:
So, in the first case the tag <WhoCalledOn> is present and the value is true.
In the second case the tag <WhoCalledOn> is not present so should be reported as null, plus, TelephoneNumber is reported twice. Something like:
Hope is clear,
thank you,
Lucas
Hi, please help on this. I want extract values of xml file structure and print in determined way.
<ProjectName> --> only appears once
<StructList> --> is the top node
<Struct> node --> could be more than 1
NameID, STX, STY, PRX, PRY --> appears only 1 time within each <Struct> node... (10 Replies)
I have xml file like below, i want change the values at default-value place of each argument name using shell script. like
where argument name= protocol and default-value=tcp,
where argument name =port and default-value= 7223,
where argument name = username and default-value=test,
example
... (12 Replies)
Good Day All
Im quiet new to ksh scripting and need a bit of your help. I am attempting to write a script that reads in an XML and extracts certain field values from an XML file. The values are all alphanumeric and consist of two components: e.g "Test 1".
I need to to create a script that... (2 Replies)
hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file
<sequence>
<Filename>aldorzum.doc</Filename>
<DivisionCode>US</DivisionCode>
<ContentType>Template</ContentType>
<ProductCode>VIMZIM</ProductCode>
</sequence>... (4 Replies)
hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file
<sequence>
<Filename>aldorzum.doc</Filename>
<DivisionCode>US</DivisionCode>
<ContentType>Template</ContentType>
<ProductCode>VIMZIM</ProductCode>
</sequence>... (1 Reply)
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)
Hi,
I need to capture all the attributes with delete next to it. The source XML file is attached.
The output should contain something like this below:
Attributes = legacyExchangeDN
Action = Delete
Username = Hero Joker
Loginid = joker09
OU =... (4 Replies)
Hello People,
I have an xml file from which I need to extract the values of the parameters using UNIX shell commands.
Ex : Input is like :
<Name>Roger</Name>
or
<Address>MI</Address>
I need the output as just :
Roger
or
MI
with the tags removed.
Please help. (1 Reply)
i have an input file of XML type with data like
<nx-charging:additional-parameter name="NX_INTERNATIONALIZED_CLID" value="919427960829"/><nx-charging:finalStatus>RESPONSE , Not/Applicable , OK</nx-charging:finalStatus></nx-charging:process>
i want to extract data such that i get the output... (3 Replies)