Skip to content

Instantly share code, notes, and snippets.

@pallymore
Created May 20, 2015 17:54
Show Gist options
  • Save pallymore/6c7e2d31f56ab4dcb07c to your computer and use it in GitHub Desktop.
Save pallymore/6c7e2d31f56ab4dcb07c to your computer and use it in GitHub Desktop.
awk command to split csv file by uniq values in the 5th column
awk -F, 'NR==1{hdr=$0;next}!($5 in files){files[$5]=1;print hdr >$5".csv"}{print>$5".csv”}’ input.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment