日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

使用ifconfig取出网卡eth0的ip地址

發布時間:2023/12/19 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 使用ifconfig取出网卡eth0的ip地址 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.


方法1:sed命令

12[root@oldboyedu?~]#?ifconfig?eth0?|sed?-n?'2p'?|sed's#^.*addr:##g'|sed?'s#??B.*$##g'10.0.0.50

方法2cut

12[root@oldboyedu?~]#?ifconfig?eth0|grep?'inetaddr'|cut?-d?":"?-f2|cut?-d?"?"?-f110.0.0.50

方法3:普通awk?使用2

12[root@oldboyedu?~]#?ifconfig?eth0|grep?'inet?addr'|awk?-F?":"?'{print?$2}'|awk?'{print?$1}'10.0.0.50

方法4awk同時多分隔符法

12[root@oldboyedu?~]#?ifconfig?eth0|grep?'inetaddr'|awk?-F?'[?:]'?'{print?$13}'10.0.0.50

方法5awk同時多分隔符法

1234[root@oldboyedu?~]#?ifconfig?eth0|sed?-n?'2p'|awk-F?'[?:]+'?'{print?$4}'10.0.0.50[root@oldboyedu?~]#?ifconfig?eth0?|awk?-F'[?:]+'?'NR==2?{print?$4}'10.0.0.50

方法6sed(正則)

12[root@oldboyedu?~]#?ifconfig?eth0?|sed?-nr?'2s#^.*dr:(.*)??B.*$#\1#gp'??????????10.0.0.50

方法7grep-perl正則方法

12[root@show?~]#?ifconfig?eth0|grep?-Po?'(?<=dr:)[0-9.]+'10.0.0.50



轉載自http://lidao.blog.51cto.com/3388056/1911571

轉載于:https://blog.51cto.com/2690403167/1966440

總結

以上是生活随笔為你收集整理的使用ifconfig取出网卡eth0的ip地址的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。