I have the following string libVersion = '1.23.45.6' and I need to replace 1.23.45.6 with 1.23.45.7.
Obviously the version could be any number with similar format (it does not have to be 4 numbers).
I tried to use the following but doesn't work
echo "libVersion = '1.23.45.6'" |sed "s/([0-9\.]+)/1.23.45.7/g"
echo "libVersion = '1.23.45.6'" |sed "s/[0-9.]\+/1.23.45.7/g"echo "libVersion = '1.23.45.6'" |sed "s/'[^']*'/'1.23.45.7'/g"Eoption with your regex (sed -E "s/([0-9.]+)/1.23.45.7/"). But/gis redundant if you want to replace once and the(...)is redundant since you are not using the captured value. I'd usesed -E "s/[0-9.]+/1.23.45.7/".