In coverage.xml, I would like to replace the filename using sed and get the coverage.xml updated.
I am using
sed -r 's~venv.*/(.*\")(.*)~location/here/src/\1\2~g' coverage.xml > newcoverage.xml
where coverage.xml has <class branch-rate="0" complexity="0" filename="venv/lib/python3.6/site-packages/test/src/abc.py" line-rate="0.9221" name="abc.py">
and expected output
<class branch-rate="0" complexity="0" filename="location/here/src/abc.py" line-rate="0.9221" name="abc.py">
This works fine in local sh, but in jenkins the output is
<class branch-rate="0" complexity="0" filename="location/here/src/
And the capture groups \1\2 are not added.
Also tried
sed -E 's~venv.*/(.*\")(.*)~location/here/src/\1\2~g' coverage.xml > newcoverage.xml
but the result is same