I want to modify my a variable by adding \ between any digit and the dot just before it,
So far I only managed to add the \ after the first digit and the first dot.
My script:
branch="3.2.5"
firstbranch=$(echo $branch | sed -r 's/([0-9]+.)(.)/\1\\2/g') && echo $firstbranch
the output it generates:
3.\2.5
and the desired output:
3.\2.\5