bash - awk print variable with spaces -


how pass variable containing space awk 1 variable?

code:

a="one" b="two three" c="four" echo $a $b $c | awk '{ print "a="$1 "\nb="$2 "\nc="$3 }' 

expected output:

a=one b=two 3 c=four 

actual output:

a=one b=two c=three 

you use awk's -v option pass shell parameters awk :

a="one" b="two three" c="four"  echo | awk -va="$a" -vb="$b" -vc="$c" '{ print "a="a "\nb="b "\nc="c }' 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -