Quote:
|
How can I ask AWK to read everything between quotation marks?
|
Code:
awk -F\" '{print $2}'
this is functionally the same as
Code:
awk 'BEGIN{FS="\""};{print $2}'
You are redefining awk's field separator to be the quotation mark. The slash mark is necessary in the first form to prevent your shell from interpreting the quote, it's necessary in the second form to show that the second quotation mark is not closing the first one.
If any input line contains no quotation marks at all this code will output a blank line.
The GNU awk is superior to all the other awks; it has the ability to do fixed-width fields and numeric base conversions. A hearty thanks to Arnold Robbins, the GNU awk maintainer!