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'
如下:
标签:24,egrep,gp,ip,sed,Linux,rn
来源: https://www.cnblogs.com/zhangyh-blog/p/15094931.html