I have the following PDF produced from matplotlib :
I have inverted in the legend, during the generation of this plot, the lines "Observed data" and "Model".
I would like to swap them to be right.
From this link :
How to swap text based on patterns at once with sed?
I tried to inspire me and to do in a shell script :
cp -p $1 back_"$1"
qpdf --stream-data=uncompress $1 uncompressed.pd
gsed 's/Observed\ data/zz/g;s/Model/Observed\ data/g;s/zz/Model/g' uncompressed.pdf > temp_uncompressed.pdf
qpdf --stream-data=compress temp_uncompressed.pdf back_"$1"
rm -f uncompressed.pdf temp_uncompressed.pdf
mv -f back_"$1" $1
and execute by simply : $ ./myShell fit.pdf
Unfortunately, the swapping is not performed and I can't see where is the error.
If someone could see what's wrong ...
And from my first tests, this shell script produces warnings or errors and I don't know if I can avoid to get them.