0

I have a problem with a sed

I have an example:

‘texttexttexttext’,47384728,’147,65’,’texttexttext’

I want this, the same but in the value number, the dot.

‘texttexttexttext’,47384728,’147.65’,’texttexttext’

I wrote something but it’s not true:

sed -e s/[0-9]\,[0-9]/\./g

But the result is this:

‘texttexttexttext’,47384728,’14.5’,’texttexttext’

Can you help me? :) Thanks!

1 Answer 1

2

Capture the digits before and after the comma.

sed -e 's/\([0-9]\),\([0-9]\)/\1.\2/g'

No need to backslash a comma, it has no meaning in sed. Also, dot is not special in the replacement part, so no backslash needed either.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .