Used sed in place edit instead of using tempfile and mv