判断一个字符串是不是ip地址
STRING="172.20.70.81" if echo $STRING | awk -F. '{for(i=1;i<4;i++){if($i<255) printf $i "."}if($4<255)print $4}' | grep -qP '^(\d+\.){3}\d+$' then echo "this is ip_addr" else echo "no ip_addr" fi
STRING="172.20.70.81" if echo $STRING | awk -F. '{for(i=1;i<4;i++){if($i<255) printf $i "."}if($4<255)print $4}' | grep -qP '^(\d+\.){3}\d+$' then echo "this is ip_addr" else echo "no ip_addr" fi