I need to extract version number for a version output like the following:
Program updated version 7.9
Released on 04-04-2013
I know how to extract a two-digit version number:
grep -Po '(version )\d+(?:\.\d+){2}')
Or any other number of digits.The problem is that the version number may have different number of digits. Is there a regex I can user for a group of several digits separated by dots provided that the number of digits is unknown?
\d[\d\.]*– regex for a string starting with a number and containing just digits and points"Program updated version 7.9"the output is7.9For"Program updated version 7.9.9"the output is still7.9and for"Program updated version 7.9.9.9"the output is7.9 9.9with a space between the pairsgrep -Po '(?<=version )[0-9.]+' filedoes it suffice or you want other conditions?