用sed从ifconfig取IP和mac地址
作弊条一个,Linux下
ifconfig | sed -e '/.*inet addr:/!d;s///;s/ .*//'
ifconfig | sed -e '/.*HWaddr \([:[:xdigit:]\-]*\).*/{s//\1/;p}'FreeBSD下
ifconfig | sed -e '/.*inet /!d;s///;s/ .*//'
ifconfig | sed -e '/.*ether/!d;s///;'都要在sh或bash里执行。
在线阅读本文 Guixing's Jail https://blog.khsing.net/2009/01/use-sed-to-got-mac-and-ip-from-ifconfig.html