#! /bin/bash
while read line
do
I=$(echo $line | awk -F "." '{print NF}')
if [[ $I -eq 4 ]]
then
m=0
for n in `echo $line | awk -F "." '{for(i=1;i<=NF;i++){print $i;}}'`
do
if [[ $n -ge 0 ]]&&[[ $n -le 255 ]]
then
m=$(($m+1))
fi
done
if [[ $m -eq 4 ]]
then
echo "yes"
else
echo "no"
fi
else
echo "error"
fi
done <nowcoder.txt
while read line
do
I=$(echo $line | awk -F "." '{print NF}')
if [[ $I -eq 4 ]]
then
m=0
for n in `echo $line | awk -F "." '{for(i=1;i<=NF;i++){print $i;}}'`
do
if [[ $n -ge 0 ]]&&[[ $n -le 255 ]]
then
m=$(($m+1))
fi
done
if [[ $m -eq 4 ]]
then
echo "yes"
else
echo "no"
fi
else
echo "error"
fi
done <nowcoder.txt