chrissx
chrissx

Reputation: 13

Sed: Regex doesn't match and I have no idea why

I have a long list of commands (most of them sed) piped together, the sed where my problem is gets input that looks like this:

v5.3-rc4/
v4.9.123/

and it should turn them into something like this:

v5.03-rc4/
v4.09.123/

My current attempt looks like this:

sed 's/v\([0-9]*\)\.\([0-9]\)\((\.[0-9]*)?(-rc[0-9]*)?\)\//v\1.0\2\3\//g'

I have already double-checked this in a RegEx-debugger and it seems to be correct. Can anyone tell me, what's wrong with this?

Upvotes: 1

Views: 46

Answers (1)

Jotne
Jotne

Reputation: 41456

Not sure what you exactly try to do, but what about change . to .0?

sed 's/\./.0/' file
v5.03-rc4/
v4.09.123/

Upvotes: 1

Related Questions