Reputation: 3
I have string this:
release/3.0.2.344
And I want to extract this:
release/3.0.2
pattern is like:
release/<number>.<number>.<number>.<number>
Upvotes: 0
Views: 37
Reputation: 36088
Use parameter expansion in bash:
$ v="release/3.0.2.344"
$ echo "${v%.*}"
release/3.0.2
%
cuts off of the end of the variable, and the search pattern is a dot .
followed by any characters *
.
Upvotes: 2