nmh-ref-hook.sh: efficiency hacks from Robert Elz

Don't need to use sed a bunch of times.  For as long as I've used
bash, I really need to learn those operators.