Do correct escaping within sed

Reference 867