Replace double quotes with single quotes.
Die on unrecognised arguments.

Also a type fix and a minor formatting change.
Make awk script work on Mac OS X.