My question is, is it possible to assign a bash variable within an awk script.
i.e Assuming following is a shell script I have written,
declare -A sample_associative_array
awk -F'=' '{$sample_associative_array[$2]=$1}' /tmp/sample.txt
given /tmp/sample.txt has:
abc=0
def=1
I tried
echo $sample_associative_array[0]
and it doesnt work.
Any help would be appreciated.
Cheers!