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"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…