从字符串的末端到其他任何字符?
我只是尝试从字符串末端到任何其他字符的数字,因此,以例如: “版本1.2.34”
将为我提供'34'
到变量$ minor
和'版本1.2。'
到变量$ type
。
这是我尝试的:
minor=$(grep -Eo '[0-9]{1,24}')
但这给了我所有的数字。
I am trying grep only the numbers from the end of the string until any other char, so from example:"Version 1.2.34"
Will give me '34'
to variable $minor
and 'Version 1.2.'
to variable $type
.
Here's what I've tried:
minor=$(grep -Eo '[0-9]{1,24}')
but this gives me ALL numbers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用纯
bash
:Using pure
bash
: