fix syntax errors introduced by poor awk replacement