Hi, this must be a simple but this is my first interaction with shell and awk.
following is a log file needed to parse (2 lines separated by a line break for clarity):
2013-07-27 13:32:09,043 - ERROR - PerformanceUtility - Thread-14 - Performance - 9b348407-4f57-4983-a057-a55669821f68 | BidirectionalCompoundProviderMediation | ProviderAdapter.Response | B1.RPBLBKL04.EGS107 | RetryID: 1374949928859 -> 1374949928859 [ 0 ] | EngineRecordLoad: 1374949928860 -> 1374949928870 [ 10 ] | StateLoading: 1374949928870 -> 1374949928871 [ 1 ] | CorrelID: 1374949928859 -> 1374949928871 [ 12 ] | TotalID: 1374949928859 -> 1374949928871 [ 12 ] | com.bofa.rp.engine.v004.broker.optimus.task.OptimusResponseTask TaskExecution: 15 | com.bofa.rp.optimus.pattern.BidirectionalCompoundProviderMediation.ProviderAdapterResponseMap TaskExecution: 0 | Propogate: 1374949928887 -> 1374949928945 [ 58 ] | Delivery: 1374949928887 -> 1374949928945 [ 58 ] | Orchestration: 1374949928871 -> 1374949928945 [ 74 ] | UpdateEngineRecord: 1374949928945 -> 1374949928948 [ 3 ] | Propogate: 1374949928950 -> 1374949929041 [ 91 ] | PublishAudit: 1374949928948 -> 1374949929042 [ 94 ] | Propogate: 1374949929043 -> 1374949929043 [ 0 ] | PublishRecovery: 1374949929042 -> 1374949929043 [ 1 ] | Execution: 1374949928859 -> 1374949929043 [ 184 ]
2013-07-27 13:32:08,723 - ERROR - PerformanceUtility - Thread-13 - Performance - b089c04a-a936-45f8-a94b-196da5494424 | BidirectionalCompoundProviderMediation | ProviderAdapter.Request | B1.RPBLBKL04.EGS105 | RetryID: 1374949928412 -> 1374949928412 [ 0 ] | EngineRecordLoad: 1374949928412 -> 1374949928419 [ 7 ] | StateLoading: 1374949928419 -> 1374949928419 [ 0 ] | CorrelID: 1374949928412 -> 1374949928419 [ 7 ] | TotalID: 1374949928412 -> 1374949928419 [ 7 ] | com.bofa.rp.engine.v004.broker.optimus.task.OptimusResponseTask TaskExecution: 14 | com.bofa.rp.optimus.pattern.BidirectionalCompoundProviderMediation.ProviderAdapterResponseMap TaskExecution: 0 | Propogate: 1374949928434 -> 1374949928612 [ 178 ] | Delivery: 1374949928433 -> 1374949928612 [ 179 ] | Orchestration: 1374949928419 -> 1374949928612 [ 193 ] | UpdateEngineRecord: 1374949928612 -> 1374949928616 [ 4 ] | Propogate: 1374949928618 -> 1374949928620 [ 2 ] | PublishAudit: 1374949928616 -> 1374949928620 [ 4 ] | Propogate: 1374949928620 -> 1374949928723 [ 103 ] | PublishRecovery: 1374949928620 -> 1374949928723 [ 103 ] | Execution: 1374949928412 -> 1374949928723 [ 311 ]
This is my attempt ...
#!/bin/awk
FILENAME="EnginePerformance.log"
cat $FILENAME | grep -E "(RPALBKL|RPBLBKL|RPCLBKL)" | awk -F '|'
'{
if ($3 ~ /.*Request.*/)
print $3 $4 $11 $12 $22 $23 $24 $25 $26 $27
else if ($3 ~ /Response/) {
print $3 $4 $6 $19 $20 $21 $22 $23
}
}'
Thanks for your help!