Wrote my replace-line script with Python.

Far more robust now. Fixes #9