So, I'm trying to find out some ways to pass external shell variables to an awk script, but I'm confused about ' and ".
First, I tried this with a shell script.
$ v=123test
$ echo $v
123test
$ echo "$v"
123test
Then I tried awk.
$ awk 'BEGIN{print "'$v'"}'
$ 123test
$ awk 'BEGIN{print '"$v"'}'
$ 123
Lastly, this is what I tried.
$ awk 'BEGIN{print " '$v' "}'
$ 123test
$ awk 'BEGIN{print ' "$v" '}'
awk: cmd. line:1: BEGIN{print
awk: cmd. line:1: ^ unexpected newline or end of string
Where is the difference?