cat /etc/redhat-release
返回:
CentOS Linux release 5.6.1804 (Core)
如何选择我只尝试过的第一个数字
cat /etc/redhat-release | awk '{print $4}'
这给了我:
5.6.1804
但我只想要第一个数字
$ echo 'CentOS Linux release 5.6.1804 (Core)'|awk '{print $4}'|awk -F '.' '{print $1}'
5
需要我多说?
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句