Hello all,
Maybe you can help me with an awk script to get what I need.
I have the input file with format below:
[2013-04-02 00:00:00.014] REQUEST|79023787741690|738227864597|985
[2013-04-02 00:00:00.215] REQUEST|79024002151717|738229423534|985
[2013-04-02 00:00:00.215] REQUEST|79024002151717|738229423534|*985
[2013-04-02 00:00:00.215] NDS-REQUEST|79024002151717|738229423534
[2013-04-02 00:00:00.215] REQUEST|79023364221647|738227504615|985
[2013-04-02 00:00:00.297] EXT-RESPONSE|79023998911716|738225664496|*702|Active|0|233
[2013-04-02 00:00:00.299] RESPONSE|79023998911716|738225664496|*702|233
[2013-04-02 00:00:00.481] NDS-RESPONSE|79024002151717|738229423534|1|AMB
[2013-04-02 00:00:00.482] RESPONSE|79024002151717|738229423534|*985|233
- Fields are separated with "|" and values in field 2 may have more than one occurence.
- I want to print only one time each value that is in field 2, where field 1 contains exactly "REQUEST" or "RESPONSE/EXT-RESPONSE",
and concatenate all the values in last fields in each ocurrence.
For example,
- 79023787741690 only appears once, then only has one "last field" that is 985
- 79024002151717 appears 5 times, but only 4 times, the line where it's present contains exactly "REQUEST" or "RESPONSE/EXT-RESPONSE".
and the last field (in order of appearence) for each occurence are 985, *985, AMB and 233
So the output for this input would be:
79023787741690|985
79024002151717|985|*985|AMB|233
79023364221647|985
79023998911716|233|233
I hope make ssense. Thanks in advance.