想想怎么取IP玩

ifconfig eth0|egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}'|sed -n "1p"
ifconfig eth0|sed -n "2p"|awk  '{print$2}'|cut -d ":" -f 2
ifconfig eth0|awk -F: '{print$2}'|sed 's/ //'|sed 's/ /\n/g'|awk 'NR==4{print}'
ifconfig eth0|head -n 2|tail -n 1|cut -c 21-32
ifconfig eth0|grep "inet addr:"|awk -F: '{print$2}'|sed "s/Bcast//g"

应该还有很多种方法 目前的所学只能写一点出来

猜你喜欢

转载自blog.51cto.com/junhai/2126440