首页 > 其他 > 详细

用awk 取出ifconfig eth0中IP的方法

时间:2016-01-27 17:38:20      阅读:259      评论:0      收藏:0      [点我收藏+]

1. ifconfig eth0|awk -F ‘[ :]+‘ ‘NR==2 {print $4}‘

2. ifconfig eth0|grep "inet addr"|awk -F ":" ‘{print $2}‘|awk ‘{print $1}‘

3. ifconfig eth0|awk -F ‘[ :]‘ ‘NR==2 {print $13}‘

以上方法,都是老师教我的,以后有新的好的方法再补充。


用awk 取出ifconfig eth0中IP的方法

原文:http://yanghongwei.blog.51cto.com/5083286/1739142

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!