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
[root@hadoop129 scripts]# ifconfig ens33 | grep netmask | cut -d " " -f 10
192.168.xxx.xxx
[root@hadoop129 scripts]# ifconfig ens33 | awk '/netmask/{print $2}'
192.168.xxx.xxx