Hello all,
I have a file containing the following
p1 q1 p2 q2 p1 p2 p3
pr1 pr2 pr1 pr2
pa1 pa2
I want to remove the last character from all strings that start with 'p' and end with '1'. In general, I do not know what is between the first part of the string and the last part of the string.
the result is then:
p q1 p2 q2 p p2 p3
pr pr2 pr pr2
pa pa2
I have tried something like this:
sed 's/\(p[^ ]*1\)./\1/g' testfile
which will find all occurences of p*1, but I do not know how to get rid of the last character occuring in the string.
Regards,
B