I have a command which is using awk with a variable:
LETTER='kiwi'
awk -v string="$LETTER" '/string/{ print $0 }' file.txt
But it seems I can't pass the value $LETTER to the awk.
What I have tried is:
LETTER='kiwi'
awk -v string="$LETTER" '\/string\/{ print $0 }' file.txt
What I would like to achieve: Pass to the awk command whatever variable I need.
Many thanks.