Regular expression: not containing string

regular expressionsed

I have two strings :

string1: platform1-05_02_00.001:platform
string2: platform1-domino-05_02_00.001:platform

in the first one, the version (05_02_00.001) is to be changed, at first I tried the regular expression:

sed -i 's/platform1-.*:platform/platform1-06:hybrisb/g' file

but it changes the 2 strings.
That's why i'm looking for some regex to tell the sed to look for the string where the isn't "domino" (not containing domino)

Best Answer

One way to do it:

sed '/domino/! s/platform1-.*:platform/platform1-06:hybrisb/g' file

/domino/! selects lines that don't match domino.

Related Question