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"
ifconfig eth0|awk "NR==2{print}"|cut -d: -f 2|tr -d "Bcast"

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