Linux下提取IP至文件

 

ifconfig | grep 'inet[^6]' | sed 's/^\s*//g' | cut -d ' ' -f2 > ips.txt

 排除127开头的IP:

ifconfig | grep 'inet[^6]' | sed 's/^\s*//g' | cut -d ' ' -f2 | sed '/^127.*/d' > ips.txt

 

posted @ 2015-03-26 11:35  flowjacky  阅读(686)  评论(0编辑  收藏  举报