Skip to content

Instantly share code, notes, and snippets.

@thepaul
Created November 3, 2010 01:52
Show Gist options
  • Save thepaul/660680 to your computer and use it in GitHub Desktop.
Save thepaul/660680 to your computer and use it in GitHub Desktop.
index records by first field and output according to that index. original need called for commas, but set VSEP to the empty string if you just want separation of multiple values with OFS.
awk '{x[$1]=x[$1]?(x[$1] VSEP OFS $2):$2}END{for(e in x){print e,x[e]}}' VSEP=,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment