Please help:
I have a data file which has many values per line eg:
lemur/front-stats-2003102459:<apiCall start="1066950214507" end="1066950216147" remoteHost="xxx" remoteAddr="xxx" contractID="oranlc1" serviceName="BillingServices.Content.ChargeReservation"><apiResponse success="yes"></apiResponse>
</apiCall>
lemur/front-stats-2003102459:<apiCall start="1066950219273" end="1066950219739" remoteHost="xxx" remoteAddr="xxx" contractID="oranlc1" serviceName="BillingServices.Content.ChargeConfirmation"><apiResponse success="yes"></apiResponse
></apiCall>
lemur/front-stats-2003102459:<apiCall start="1066950219903" end="1066950225208" remoteHost="xxx" remoteAddr="xxx" contractID="akumiitti2orangelc1" serviceName="BillingServices.Content.ChargeConfirmation"><apiResponse success="no"><reason><code>
107</code></reason></apiResponse></apiCall>
the above shows 3 lines (start with lemur, end with </apiCall>)
Originally I only wanted the start_t, end_t, charge_request and the success value so the following statement was sufficient:
awk -F\" '{print $2","$4","$12","$14}' $InputFile > $OutputFile
I now need the code value if the success = no (between <code> and </code>) but this is not between double quotes AND is only on the failed transaction lines eg 3rd line of given example.
Please can someone suggest a solution to this, it has been racking my brains and I produced a crude solution using sed and awk to replace unwanted text!! Surely there is something in awk to solve this?
Thanks all
Lee
I have a data file which has many values per line eg:
lemur/front-stats-2003102459:<apiCall start="1066950214507" end="1066950216147" remoteHost="xxx" remoteAddr="xxx" contractID="oranlc1" serviceName="BillingServices.Content.ChargeReservation"><apiResponse success="yes"></apiResponse>
</apiCall>
lemur/front-stats-2003102459:<apiCall start="1066950219273" end="1066950219739" remoteHost="xxx" remoteAddr="xxx" contractID="oranlc1" serviceName="BillingServices.Content.ChargeConfirmation"><apiResponse success="yes"></apiResponse
></apiCall>
lemur/front-stats-2003102459:<apiCall start="1066950219903" end="1066950225208" remoteHost="xxx" remoteAddr="xxx" contractID="akumiitti2orangelc1" serviceName="BillingServices.Content.ChargeConfirmation"><apiResponse success="no"><reason><code>
107</code></reason></apiResponse></apiCall>
the above shows 3 lines (start with lemur, end with </apiCall>)
Originally I only wanted the start_t, end_t, charge_request and the success value so the following statement was sufficient:
awk -F\" '{print $2","$4","$12","$14}' $InputFile > $OutputFile
I now need the code value if the success = no (between <code> and </code>) but this is not between double quotes AND is only on the failed transaction lines eg 3rd line of given example.
Please can someone suggest a solution to this, it has been racking my brains and I produced a crude solution using sed and awk to replace unwanted text!! Surely there is something in awk to solve this?
Thanks all
Lee