ip addr|awk '/inet /{gsub(/\/.*/," " ,$2);print $2}'
ip addr 显示本机ip地址
awk中'/inet/{gsub (/\.*/," ",$2);print $2}'
匹配含inet空格的行,并且把匹配的行中第二个域中/以后的字符换成空格,再打印第二个域
gsub函数相当于bash中sed命令 sed 's///g'