How to make awk ignore the field delimiter inside double quotes? [duplicate]

From the GNU awk manual (http://www.gnu.org/software/gawk/manual/gawk.html#Splitting-By-Content):

$ awk -vFPAT='([^,]*)|("[^"]+")' -vOFS=, '{print $1,$4}' file
"[email protected],www.example.com",field4
"[email protected]",field4

and see What’s the most robust way to efficiently parse CSV using awk? for more generally parsing CSVs that include newlines, etc. within fields.

Leave a Comment