截取网卡IP地址

方法一:

ifconfig eth1|awk 'NR==2 {print $2}'

方法二“”

ifconfig eth1|grep -Po "(?<=inet )d{1,3}(.d{1,3}){3}"

ifconfig eth1|grep -Po '(?<=inet ).*(?= net.*)'

方法三:

ifconfig eth1|sed -n '2s/inet//gp'|sed 's/net.*//g'

其他:

ifconfig eth1|grep 'inet '|awk '{print $2}'
原文地址:https://www.cnblogs.com/xkus/p/7481334.html