方法1:sed查询打印
[root@Linux9~]#ifconfigeth0|grep"inetaddr:"|sed's/Bcast.*$//'g|sed's/.*://g' 192.168.25.57
方法2:awk查询打印
[root@Linux9~]#ifconfigeth0|grep"inetaddr:"|sed's/Bcast.*$//'g|awk-F":"{'print$2'}
192.168.25.57
方法3:cut分段打印
[root@Linux9~]#ifconfigeth0|grep'Bcast'|cut-d':'-f3|cut-d""-f1 192.168.31.255
方法4:awk查询打印子网掩码
[root@Linux9~]#ifconfigeth0|grep'Mask'|awk-F:'{print$4}'
255.255.240.0