Created
September 25, 2014 02:05
-
-
Save amosshapira/c9ba2d62c0372f4eefb4 to your computer and use it in GitHub Desktop.
Extract double-quoted fields from CSV file using GNU Awk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/gawk -f | |
# Taken from http://stackoverflow.com/a/8949920/164137 | |
BEGIN { | |
FS="," | |
FPAT="([^,]+)|(\"[^\"]+\")" | |
} | |
{ | |
for (i=1;i<=NF;i++) | |
printf ("[%s] ",$i); | |
print "" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment