#!/bin/bash
F_FAILED="RESULT-SN-FAILED.log"
F_COUNTER="RESULT-SN-COUNTER.log"
F_TMP="tmp.log"
#V_FILE_RECORD="test.txt"
V_FILE_RECORD="1-all-file.txt"
V_FLAG="Hamild1"
>$F_FAILED
>$F_COUNTER
>$F_TMP
cat $V_FILE_RECORD|grep "\-\-"|awk -F "-----------" '{print $2}'|while read a;
do
echo "[INFO]start to deal with $a";cat $V_FILE_RECORD|grep $a|grep zip|grep $V_FLAG|while read b;
do
echo $b >> $F_TMP
v_FALSE=0;echo --------$b;rm -rf /tmp/*;unzip $b -d /tmp;echo "[LOG]$(find /tmp/ -name \"*.log\"|grep EM)";
if [[ $(cat $(find /tmp/ -name "*.log"|grep EM)|grep -i item|grep -i FALSE) -gt 0 ]];then
v_flag=$(cat $(find /tmp/ -name "*.log"|grep EM)|grep -i item|grep -i FALSE|awk -F "\"" '{print $2}')
echo "[INFO FAILED]SN=$a,STATION=$V_FLAG,SOURCEFILE=$b" >> $F_FAILED
sed -n '/$v_flag/,/$v_flag/{p}'; >> $F_FAILED
else
echo "[INFO SUCCESS]SN=$a,STATION=$V_FLAG,SOURCEFILE=$b" >> $F_FAILED
fi;
done;
done
----------------
1-all-file.txt
-----------EM38Y0002J40008
/LogFile/Backup/Data/LXXare-HamiltonCT/EM38Y00er00820230902003945.zip
/LogFile/Backup/Data/LCChare-HamiltonCT/EM38Yer00820230927084946.zip