Another alternative would be to use the FPAT
variable, that defines a regular expression describing the contents of each field.
Save this AWK script as parse.awk
:
#!/bin/awk -f
BEGIN {
FPAT = "([^ ]+)|(\"[^\"]+\")"
}
{
print $2
}
Make it executable with chmod +x ./parse.awk
and parse your data file as ./parse.awk data.txt
:
"I am ABC"
"I am not ABC"