#/bin/bash for i in cat met.txt do ping=ping -c 1 $i | grep loss | awk -F "%" {'print$1'} | awk '{print$NF}' if [ $ping -eq 100 ]; then echo $i fail else echo $i ok fi done