To pass the value of a shell variable to awk you have to use the -v option. For example:
Code:
awk -v dt=$dt 'the_awk_program_here'
the reason is that you embed the awk program in single quotes and they prevent the shell to do any substitution, that is the string "$dt" is interpreted literally. Take a look
here and
here for more details.