shell编程-提取IP地址

1、使用cut文本处理工具提取
[root@hadoop129 scripts]# ifconfig ens33 | grep netmask | cut -d " " -f 10
192.168.xxx.xxx
2、使用awk文本处理工具提取
[root@hadoop129 scripts]# ifconfig ens33 | awk '/netmask/{print $2}'
192.168.xxx.xxx

 

posted @ 2022-09-18 16:01  淘气的包子  阅读(161)  评论(0)    收藏  举报