I would like to extract from a log file that contains mostly Java log data (debug/errors/info) the following XML:
<envelope>
<header>
...
</header>
<body>
<Provision>
<ORDER id="XYZ_123_456" action="test">
....
</ORDER>
</Provision>
</body>
</envelope>
I only need the one which has the "Provision" tag, and which contains the ORDER id XYZ_123_456
I've tried using the following, but it also returns XMLs without the Provision tag. (I'm near clueless in awk, this is a code I've modified for this particular need)
awk '/<envelope>/ {line=$0; p=0 && x=0; next}
line {line=line ORS $0}
/ORDER/ && $2~/XYZ_123_456/ {p=1}
$0~/<Provision>/ {x=1}
/<\/envelope>/ && p && x {print line;}' dump.file
Thanks!