Skip to content

Instantly share code, notes, and snippets.

@saswata-dutta
Created September 1, 2023 05:46
Show Gist options
  • Save saswata-dutta/8a809179a25e55379e131e28299ea90c to your computer and use it in GitHub Desktop.
Save saswata-dutta/8a809179a25e55379e131e28299ea90c to your computer and use it in GitHub Desktop.
cat some.logs | ggrep -n -P -o '"orderId":"[0-9-]+"|x-account-id=[0-9]+|"errorCode":"\w+"' | gawk -F':' '{arr[$1]=arr[$1]","$0} END {for (i in arr) print arr[i]}'
,1:"orderId":"1",1:x-account-id=6398441113,1:"errorCode":"e1",1:"errorCode":"e11"
,3:"orderId":"2",3:x-account-id=6398441113,3:"errorCode":"e2",3:"errorCode":"e12"
,5:"orderId":"3",5:x-account-id=6398441113,5:"errorCode":"e3",5:"errorCode":"e13"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment