Revert "Revert. I am never using sed for cleanup again."

This reverts commit 6dfa85de2b0d12decb1f1623e03f833450bced35.