Improve script compatibility by replacing PCRE grep with awk (resulting in overall nicer code)