Try replacing sed with python, compare results