aboutsummaryrefslogtreecommitdiffstats
path: root/awklib/eg/misc/test-csv.awk
blob: 7dbf414c34319deed504dcd9298d76b9d97e5980 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
BEGIN {
     fp[0] = "([^,]+)|(\"[^\"]+\")"
     fp[1] = "([^,]*)|(\"[^\"]+\")"
     fp[2] = "([^,]*)|(\"([^\"]|\"\")+\")"
     FPAT =  fp[fpat+0]
}

{
     print "<" $0 ">"
     printf("NF = %s ", NF)
     for (i = 1; i <= NF; i++) {
         printf("<%s>", $i)
     }
     print ""
}