sed help with character removal

Hello

I've got a string of text with a number in pence, e.g. 0.52p, I need to remove the 'p' so that it just reads 0.52 without of course removing all the other 'p' characters.

Many thanks

$ echo 'abcp 10p 0.52p' | sed 's/\([0-9.][0-9.]*\)p/\1/g'
abcp 10 0.52

1 Like