I have a csv file with the format :
"a b c","d","e","f",
"bla","bla","bli","fff"
The FPAT as given here by the official GNU site stipulate that "Assigning a value to FPAT overrides field splitting with FS and with FIELDWIDTHS." However, I have tried their code :
BEGIN {
FPAT = "([^,]+)|(\"[^\"]+\")"
}
{
print "NF = ", NF
for (i = 1; i <= NF; i++) {
printf("$%d = <%s>\n", i, $i)
}
}
with this :
echo 'Robbins,Arnold,"1234 A Pretty Street, NE",MyTown,MyState,12345-6789,USA' | gawk -f bin/test.awk
and here is the not expected result :
NF = 5
$1 = <Robbins,Arnold,"1234>
$2 = <A>
$3 = <Pretty>
$4 = <Street,>
$5 = <NE",MyTown,MyState,12345-6789,USA>
I think the default FS (space) was not overriden. Any idea please ?