Hi, Guys,
There is one question about AWK format. Here is the code:
gawk -F: '/^Dan/ {print "Dan's phone number is ",$2}' lab3.data
An syntax error will come out because the quote mark between Dan and s and first quote mark are recognized as a quote pair.
I want to get the input like this:
I know if I put the awk program instruction into a file, it will work well. However, is there anything else to solve it in the command line?
Thanks.
It's not an awk problem, it's a shell problem. Single quotes inside single quotes are taken to end a single quote block and there's no way to escape them inside single quotes (since you can't escape anything in single quotes, at all, ever.)