I'm trying to extract information from an environment variable in my Travis-CI config so I'm looking for a 1-line linux command that'll do this based on my regex. Here's what I'm trying:
- MAJOR_VERSION=`sed -i 's/[v?]((([\d]+)\.[\d]+)\.[\d]+)/$1/g' <<< ${TRAVIS_TAG}`
- MINOR_VERSION=`sed -i 's/[v?]((([\d]+)\.[\d]+)\.[\d]+)/$1.$2/g' <<< ${TRAVIS_TAG}`
- PATCH_VERSION=`sed -i 's/[v?]((([\d]+)\.[\d]+)\.[\d]+)/$1.$2.$./g' <<< ${TRAVIS_TAG}`
It appears sed expects a file or files because I get the error sed: no input files, not a string. How can I get it to expect a string?
My objective is to take a semantic version tag (e.g. - v12.34.56 or 12.34.56 and extract the version numbers.