A sed expression can be fairly general and still work so long as you version remains in the form of 
v[any number of digits].[any number of digits]
To use sed, you can simply pipe the output of hugo version to your sed expression, e.g.
$ hugo version | sed 's/^.*\(v[0-9][0-9]*[.][0-9][0-9]*\).*$/\1/'
Example Use/Output
With your output that would result in:
$ hugo version | sed 's/^.*\(v[0-9][0-9]*[.][0-9][0-9]*\).*$/\1/'
v0.49
You can capture the result in a variable using command substitution, e.g.
hversion=$(hugo version | sed 's/^.*\(v[0-9][0-9]*[.][0-9][0-9]*\).*$/\1/')
Explanation of sed Expression
The breakdown of the sed expression is the normal substitution s/find/replace/ where:
- findis:- 
- ^.*- and number of characters from the beginning,
- \(- begin a capture group to save what follows,
- v- the character- 'v',
- [0-9][0-9]*- at least 1 digit followed by zero or more digits,
- [.]- a decimal point (or period), followed by
- [0-9][0-9]*- at least 1 digit followed by zero or more digits,
- \)- end the capture group saving the captured content,
- .*$- all characters to the end of the string.
 
- replaceis:- 
- \1a single backreference to the text from the first capture group.
 
That is the extent of it. A normal substitution using a single backreference which will work the same for v0.49 as it will for v243.871.
     
    
hugoyou can't guarantee that anything would be future-proof.hugo versionon my system isHugo Static Site Generator v0.59.0-DEV/extended linux/amd64 BuildDate: unknown, so you might want to be careful with any solutions posted here.