Skip to content

Instantly share code, notes, and snippets.

@keyan
Created March 17, 2022 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keyan/c0ba61ceffcaa462c02ee0e20348795d to your computer and use it in GitHub Desktop.
Save keyan/c0ba61ceffcaa462c02ee0e20348795d to your computer and use it in GitHub Desktop.
awk command to comma-delimited group second column based on value of first column
awk '{if(a[$1])a[$1]=a[$1]", "$2; else a[$1]=$2;}END{for (i in a)print i, a[i];}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment