linux中怎样在/etc/sysconfig/network-scripts/ifcfg-eth0配置文件中提取出IP啊?用awk或者sed??
2个回答
展开全部
[root@iZ259r7h4pfZ ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.173.27.12
NETMASK=255.255.248.0
[root@iZ259r7h4pfZ ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0|awk -F= '/IPADDR/{print $2}'
10.173.27.12
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.173.27.12
NETMASK=255.255.248.0
[root@iZ259r7h4pfZ ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0|awk -F= '/IPADDR/{print $2}'
10.173.27.12
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询