ip addr|sed -n ‘9p‘|egrep ‘[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}‘|sed -nr ‘s#^.*inet (.*) brd(.*)$#\1#gp‘|sed -rn ‘s#^(.*)/24#\1#gp‘|sed -rn ‘s#(.*)\.(.*)\.(.*)\.(.*)#\4#gp‘
如下:
2021-11-04 00:04:24
ip addr|sed -n ‘9p‘|egrep ‘[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}‘|sed -nr ‘s#^.*inet (.*) brd(.*)$#\1#gp‘|sed -rn ‘s#^(.*)/24#\1#gp‘|sed -rn ‘s#(.*)\.(.*)\.(.*)\.(.*)#\4#gp‘
如下: