Skip to content

Instantly share code, notes, and snippets.

@kmatt
Last active November 29, 2017 14:16
Show Gist options
  • Save kmatt/a15467a3904627050ed5 to your computer and use it in GitHub Desktop.
Save kmatt/a15467a3904627050ed5 to your computer and use it in GitHub Desktop.
CSV parsing in Awk
#Requires GNU awk 4+, but eliminates the need for a specialized CSV library to handle quoted fields that contain delimiters.
#http://www.gnu.org/software/gawk/manual/html_node/Splitting-By-Content.html
#http://stackoverflow.com/a/17287068/75386
gawk -vFPAT='[^,]*|"[^"]*"' '{print $1,$2,$3}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment