I am writing a bash script to call awk -v.
The following is the bash script
I want to pass a variable from bash to awk to match against the first column of the file and display the content of second column if it is matched exactly.
Thanks for any help
The following is the bash script
Code:
inp='sles10'
result=$(awk -v var1=$inp '$1~/^$var1$/ {print$2}' /etc/testtext)
echo $result
Thanks for any help