I have an application that creates logs in the format
2014-09-01 12: 01: 01.899; And, some app logs
2014-09-01 12: 01: 02,045; And, some app logs2;<a><b><c><d><e>some data</e></d><d><e>123456789</e></d><d><e>some data</e></d><d><e>some data</e></d></c></b></a>;some app logs3
2014-09-01 12: 01: 03,625; And, some app logs4
Using the bash tools I would like to remove all tags that do not have descendant 123456789
to such form
2014-09-01 12: 01: 01.899; And, some app logs
2014-09-01 12: 01: 02,045; And, some app logs2;<a><b><c><d><e>123456789</e></d></c></b></a>;some app logs3
2014-09-01 12: 01: 03,625; And, some app logs4
I tried to do this using awk and sed, but I failed. Please help in writing a script or an indication of other tools that can do this.
Regards
Krzysiek
No comments:
Post a Comment