My sed expression looks as belos:
sed -i "s/-D CONSOLELOG /-D CONSOLELOG -fPIC /g" makefile.init
makefile.init
CFLAGS = -std=c99 -rdynamic -g -Wall -Wno-write-strings -D CONSOLELOG
Output after 1st Run( As expected)
CFLAGS = -std=c99 -rdynamic -g -Wall -Wno-write-strings -D CONSOLELOG -fPIC
2nd Run (Notice the extra fPIC at the end)
CFLAGS = -std=c99 -rdynamic -g -Wall -Wno-write-strings -D CONSOLELOG -fPIC -fPIC
I need to modify my sed expression to get output as in (1) irrespective of the number of times it is executed