corrects mage test for -m

replaces grep with awk, for lacking -M