Replaced broken sed script with python one.