meas is a shell variable, and this works perfectly fine for me:
awk -v var=$meas -F, '$1==var' /abcd/efgh.txt > temp1.csv
However, i want to introduce another shell variable, named, defnfile in the statement, in place of hardcoded path for efgh.txt like:
awk -v var=$meas -F, '$1==var' $defnfile > temp1.csv
This does not work..
So how does one define two shell variables in a single awk statement?
What's the error message that you get?
P.S. Quoting the variables is a good habit:
awk -v var="$meas" -F, '$1==var' "$defnfile" > temp1.csv
Its not fetching the correct value.
defnfile is a shell variable, not awk variable...
You're using it as a shell (not AWK) variable in the command you posted.
What's the output from:
printf "%s\n" "$defnfile"
awk '{ print FILENAME; exit } "$defnfile"