方法1:sed查询打印
[[email protected] ~]# ifconfig eth0 |grep "inet addr:" |sed ‘s/Bcast.*$//‘g |sed ‘s/.*://g‘ 192.168.25.57
方法2:awk查询打印
[[email protected] ~]# ifconfig eth0 |grep "inet addr:" |sed ‘s/Bcast.*$//‘g |awk -F ":" {‘print $2‘} 192.168.25.57
时间: 2024-11-05 23:25:44