方法1:sed查询打印
[root@Linux9 ~]# ifconfig eth0 |grep "inet addr:" |sed ‘s/Bcast.*$//‘g |sed ‘s/.*://g‘ 192.168.25.57
方法2:awk查询打印
[root@Linux9 ~]# ifconfig eth0 |grep "inet addr:" |sed ‘s/Bcast.*$//‘g |awk -F ":" {‘print $2‘} 192.168.25.57
本文出自 “boyhack” 博客,请务必保留此出处http://461205160.blog.51cto.com/274918/1742614
原文:http://461205160.blog.51cto.com/274918/1742614