You need to use
echo "Version: 4.4.0.157.165" | sed -E 's/.*Version: ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\.[0-9]+/\1/'
Or, a bit more enhanced:
sed -E 's/.*Version: ([0-9]+(\.[0-9]+){3})\.[0-9]+/\1/' <<< "Version: 4.4.0.157.165"
See the online sed demo
Notes:
- Do not use backslashes where they are not supposed to be (remove
\ before V)
\d is not supported in sed, use [0-9] instead, even with -E option
- You need to use a
\1 placeholder in the replacement part to put back what you captured in Group 1
- One of the dots was not escaped
- If your consecutive subpatterns repeat, it is a good idea to use the range quantifier.
[0-9]+(\.[0-9]+){3} matches 1+ digits, and then 3 occurrences of . and 1+ digits.
On second thought, you might want to extract the version from a larger string. Then, use
sed -nE 's/.*Version: ([0-9]+(\.[0-9]+){3})\.[0-9].*/\1/p' <<< "Version: 4.4.0.157.165"