Hi,
I have one soap xml response and it contains repeating node name.
sample as below:
Code:
<ax279:nodes xsi:type="ax277:ChildIdentifierList">
<ax277:id>3</ax277:id>
<ax277:name>test</ax277:name>
<ax277:children xsi:type="ax277:EntityIdentifier">
<ax277:id>9</ax277:id>
</ax277:children>
<ax277:children xsi:type="ax277:EntityIdentifier">
<ax277:id>10</ax277:id>
<ax277:name>hello.world</ax277:name>
</ax277:children>
</ax279:nodes>
I need to extract
<ax277:name>test</ax277:name> value based on app name
hello.world from xml.
But issue is hello.world keep repeating under other tags too.
And tag name <ax277:name> also repeating.
If it was only one then I would have done with awk or grep or sed.
But still there is problem:
I used grep as below:
Code:
grep -oPm1 "(?<=<ax277:name>)[^<]+" node.xml
its only returning me first occurred value under that tag.
Then i tried with awk, it has returned all the values w.r.t that tag.
Code:
awk -F "[><]" '/ax277:name/{print $3}' node.xml
Can I pass both parent tag name with child tag to get single value?
something like: awk -F "[><]" '/
ax279:nodes/ax277:name/{print $3}' node.xml
i tried above but again its syntax error.
Any idea?