I have a file app.spec with the string:
Version: 1.0.0
I want to replace 1.0.0 with the variable version
e.g. 1.0.1
.
The regex below which matches this but how can I replace only the first occurrence?
sed -i -E "s/[0-9]+\.[0-9]+\.[0-9]+/$version/" ./app.spec
I tried but it didn't work.
sed -i -E "0,/[0-9]+\.[0-9]+\.[0-9]+/$version/" ./app.spec