updated to use AWK instead of GAWK