擷取ip
方法一
[root@192 andy]# ifconfig eth0|grep -w inet|cut -d " " -f 12|cut -d ":" -f 2
192.168.151.141
方法二
[root@192 andy]# ifconfig eth0|grep -w inet|cut -c 21-35
192.168.151.141
方法三
[root@192 andy]# ifconfig eth0|grep -w "inet" |cut -d " " -f 12|sed 's/^.*://g'
192.168.151.141
方法四
[root@192 andy]# ifconfig eth0|grep -w "inet" |cut -d " " -f 12|awk -F ":" '{print $2}'
192.168.151.141
方法五
[root@192 andy]# ifconfig eth0|grep -w "inet" |sed -e 's/^.*addr://g ; s/Bcast.*$//g'
192.168.151.141
或
[root@192 andy]# ifconfig eth0|grep -w "inet" |sed -e 's/^.*addr://g'
[root@192 andy]# ifconfig eth0|grep -w inet|cut -d " " -f 12|cut -d ":" -f 2
192.168.151.141
方法二
[root@192 andy]# ifconfig eth0|grep -w inet|cut -c 21-35
192.168.151.141
方法三
[root@192 andy]# ifconfig eth0|grep -w "inet" |cut -d " " -f 12|sed 's/^.*://g'
192.168.151.141
方法四
[root@192 andy]# ifconfig eth0|grep -w "inet" |cut -d " " -f 12|awk -F ":" '{print $2}'
192.168.151.141
方法五
[root@192 andy]# ifconfig eth0|grep -w "inet" |sed -e 's/^.*addr://g ; s/Bcast.*$//g'
192.168.151.141
或
[root@192 andy]# ifconfig eth0|grep -w "inet" |sed -e 's/^.*addr://g'
-e 's/Bcast.*$//g'
192.168.151.141
方法六
[root@192 andy]# ifconfig eth0|grep -w inet|awk -F ":" '{print $2}'|awk '{print $1}'
192.168.151.141
方法七
[root@192 andy]# ifconfig eth0|grep inet|awk -F "[ :]" '{print $13}'
192.168.151.141
方法八
[root@192 andy]# ifconfig eth0|awk -F "[ :]+" 'NR==2{print $4}'
192.168.151.141
192.168.151.141
方法六
[root@192 andy]# ifconfig eth0|grep -w inet|awk -F ":" '{print $2}'|awk '{print $1}'
192.168.151.141
方法七
[root@192 andy]# ifconfig eth0|grep inet|awk -F "[ :]" '{print $13}'
192.168.151.141
方法八
[root@192 andy]# ifconfig eth0|awk -F "[ :]+" 'NR==2{print $4}'
192.168.151.141
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27181165/viewspace-775810/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- php字串擷取函式,支援中文擷取PHP字串函式
- js擷取JS
- 前端字型擷取前端
- PHP字串擷取PHP字串
- PHP擷取html文章PHPHTML
- php中英字串擷取PHP字串
- 批量擷取pdf檔案
- jQuery字串擷取詳解jQuery字串
- php ffmpeg 視訊擷取PHP
- Java 圖片裁剪,擷取Java
- 音訊擷取分割工具音訊
- MySQL查詢擷取分析MySql
- iOS擷取NSString字串iOS字串
- tcpdump擷取MySQL報文TCPMySql
- Mysql字串擷取函式MySql字串函式
- 新版字元擷取函式字元函式
- 求擷取圖片等比公式公式
- substr擷取函式 筆記函式筆記
- MySQL 字串函式:字串擷取MySql字串函式
- ImageView長圖擷取部分展示View
- iOS NSString字串擷取方法iOS字串
- shell 擷取變數的字串變數字串
- JavaScript 擷取指定指定區間字串JavaScript字串
- Shell中的字串擷取介紹字串
- php 擷取中英文混合字串PHP字串
- js 擷取檔案字尾名JS
- js擷取影片的封面圖片JS
- C#常用字串擷取C#字串
- shell 使用陣列及字串擷取陣列字串
- vue 擷取視訊第一幀Vue
- 第 3 章 查詢擷取分析
- QT擷取螢幕的實現QT
- long型別資料的擷取型別
- 擷取圖片生成頭像外掛
- Linux下的字串擷取詳解Linux字串
- javascript擷取指定指定區間的字串JavaScript字串
- swift 字串學習 (index用法和擷取)Swift字串Index
- iOS擷取特定的字串(正則匹配)iOS字串