1.grep :ifconfig eth0 | grep -o ‘^[^6]* addr:[0-9.]*’ | grep -o [0-9.]*
2.sed :ifconfig eth0 | sed -nr ‘s#^.*dr:(.*) B.*$#/1#g’p
3.sed :ifconfig eth0 | sed -nr “/^.*dr:(.*) B.*/s##/1#”p
4:awk :ifconfig eth0 | awk -F ‘[ :]+’ ‘NR==2{print $4}’
5:ifconfig eth0 |awk ‘/addr:[[:digit:]]/”{print $2}’ |sed ‘s/addr://g’
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/1992.html