I want to filter on the first field equal to the value of VAR. There is a similar problem here,
~ solution (SOL1) I have not been able to reproduce. However, that based on
eval (SOL2) works, but seems contrived. I'm looking for a solution that is more like SOL1.
$ cat tmp a b c d e f g h i $ awk '$1 ~ /d/' tmp d e f $ VAR='d'
$ awk '$1~VAR' tmp a b c d e f g h i
$ CMD='awk '"'"'$1'"~/$VAR/'" $ echo "$CMD" awk '$1~/d/' $ eval "$CMD" tmp d e f