Unix:XML标记之间的通配符子字符串搜索
我有一个巨大的web服务请求和响应的XML日志文件。 每个Web服务都有一个请求标记,如下所示Unix:XML标记之间的通配符子字符串搜索,xml,linux,shell,unix,Xml,Linux,Shell,Unix,我有一个巨大的web服务请求和响应的XML日志文件。 每个Web服务都有一个请求标记,如下所示 <s:Envelope ......Some tags before Request tag <xyzServiceRequest>Request Data </xyzServiceRequest></s:Body></s:Envelope> <s:Envelope ....Some more tags before Request
<s:Envelope ......Some tags before Request tag <xyzServiceRequest>Request Data </xyzServiceRequest></s:Body></s:Envelope>
<s:Envelope ....Some more tags before Request tag <abcServiceRequest xmlns="urn" >Request Data of another service </abcServiceRequest></s:Body></s:Envelope>
<s:Envelope ...Few more tags before request <defServiceRequest xmlns="urn" /> </s:Body></s:Envelope>
使用
grep-o'使用它来避免重复结果grep-o'@arun kumar:interest。我本来会做一个‘排序| uniq’,但那会增加N log N成本。“| sort | uniq”的好处在于,添加uniq-c并获得出现次数很容易。我相信你也可以用awk来做这件事。
grep -o '<[^</]*ServiceRequest' YourLogFile | sed 's/<//'