Debian Codegraph @

awklib/eg/misc/quoted-csv.awk

raw
1 BEGIN {
2 FPAT = "([^,]*)|(\"([^\"]|\"\")+\")"
3 OFS = "\t" # Print tab-separated values
4 }
5
6 {
7 for (i = 1; i <= NF; i++) {
8 # Extract data from double-quoted fields
9 if (substr($i, 1, 1) == "\"") {
10 gsub(/^"|"$/, "", $i) # Remove enclosing quotes
11 gsub(/""/, "\"", $i) # Convert "" to "
12 }
13 }
14 $1 = $1 # force rebuild of the record
15 print
16 }