Use sed before tr

Fixes #9 for BSD `sed`.