ip addr show ens33 | awk -F "[ /]+" '/inet /{print $3}'
或
ifconfig ens33 | awk -F "[ :]+" '/inet /{print $4}'
或格式化输出所有网卡的IP
for dev in $(awk -F : '{if(NR>2)print $1}' /proc/net/dev);do printf '%+10s: ' $dev;echo $(ip addr show $dev | awk -F "[ /]+" '/inet /{print $3}'); done