The linefeed between the final "d" and "}" seems to be significant for these versions of sed. And they are quite anal about comments, so move them outside of the sed statement here.
The linefeed between the final "d" and "}" seems to be significant for these versions of sed. And they are quite anal about comments, so move them outside of the sed statement here.