I use sed in CentOs to extract version number and it's work fine:
echo "Version 4.2.4 (test version)" | sed -nre 's/^[^0-9]*(([0-9]+\.)*[0-9]+).*/\1/p'
But my problem is that i am not able to extract when the version is shown like this:
Version 4.2.4-RC1 (test version)
I want to extract the 4.2.4-RC1 if it is present.
Any ideas ?
EDIT
maybe the extract is make from a path like this: /var/opt/test/war/test-webapp-4.1.56-RC1.war. It's not the same format each time. Like :
echo "var/opt/test/war/test-webapp-4.1.56-RC1.war" | sed -nre 's/^[^0-9]*(([0-9]+\.)*[0-9]+).*/\1/p'
Aucun commentaire:
Enregistrer un commentaire