Hi,
is the output from awk '{printf var}' always redirected to a file.
In this case when I exactly replicated your code, it says can't open db2 for reading or writing(This file was not there before). When I created a file called as db2, it does not throw any error, but still returns an empty db2...