The problem with the statement awk '$5 >= $dt' ... is that the "$dt" is inside single quotes and gets passed literally to awk. What you want is for the shell to expand the "$dt" (but not the "$5"!). Try something like: echo '$5 >=' $dt >/tmp/whatever awk -f /tmp/whatever ...