tag=0 for file in Directory_PATH/* do stat_file=`grep "#ST#" $file|cut -d"," -f4` echo "#####$stat_file==" #cat tempimp1|grep "^HS.*"|while read line1 while read line1 do hsval=`grep "^HS."` echo "========$hsval----" if [ "$stat_file" == "$hsval" ] then val=`grep "1001,Duplicate FORE" $file` echo "===sarfaraz" if [ "$val" == " " ] then echo "SUCCESS" #tag=127 else echo "yamamama" tag=127 echo "$tag###########" fi else echo "FILE IS NOT MATCHING " fi done < tempimp1 exit done rm -f tempimp1 echo "------$tag#####" if [ "$tag" == "127" ] then echo "FAILED" exit 127 else echo "FINAL SUCCESS"