bash use shell variables in awk code example
Example: bash how to pass shell variables to awk
# Example usage (one variable):
variable="one shell\nvariable"
awk -v var="$variable" 'BEGIN {print var}'
--> one shell
--> variable
# Example usage (multiple variables):
var1="multiple"
var2="shell"
var3="variables"
awk -v a="$var1" -v b="$var2" -v c="$var3" 'BEGIN {print a,b,c}'
--> multiple shell variables