this is an OSX BSD `sed` thing, try `perl -p -e '/^#/d' "$TMPFILE"`