comparison bin/preExtract.sh @ 52:9cd9daf75183

working towards more robust diff checking
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Mon, 13 Apr 2020 14:12:12 +0100
parents 427056f1784e
children 396d1f17c671
comparison
equal deleted inserted replaced
51:427056f1784e 52:9cd9daf75183
82 echo " " checking... >> log 82 echo " " checking... >> log
83 cut -f 1 -d " " ${e}_diff.txt | sus > ${e}_check.txt 83 cut -f 1 -d " " ${e}_diff.txt | sus > ${e}_check.txt
84 ni=${#ii[@]} 84 ni=${#ii[@]}
85 if [ $(wc -l < ${e}_check.txt) -ne $((ni + 1)) ] 85 if [ $(wc -l < ${e}_check.txt) -ne $((ni + 1)) ]
86 then 86 then
87 if [[ "$(tr -s "\n\t " " " < ${e}_check.txt)" =~ \ 87 if egrep -n '^[1-9]' ${e}_diff.txt | $HOME/bin/nogood.py $e $ni
88 ^" "[0-9]*" > 1 < 1 --- 1 "[0-9]*c[0-9]*" 1 "[0-9]*"a"[0-9,]*" "$ ]] 88 then
89 then 89 continue
90 : 90 fi
91 else
92 echo " " "extra lines in ${e}_check.txt" >> log
93 continue
94 fi
95 elif [ $(fgrep -c a ${e}_check.txt) -ne $ni ]
96 then
97 echo " " "non-addition lines in ${e}_check.txt" >> log
98 continue
99 fi 91 fi
100 echo " " starting tar update >> log 92 echo " " starting tar update >> log
101 egrep "^> " ${e}_diff.txt | cut -f 2 > ${e}_new.txt 93 egrep "^> " ${e}_diff.txt | cut -f 2 > ${e}_new.txt
102 tar --delete -f ${h}/${s}/extract_${e}.tar "${lff[@]}" 94 tar --delete -f ${h}/${s}/extract_${e}.tar "${lff[@]}"
103 tar --append -f ${h}/${s}/extract_${e}.tar --files-from=${e}_new.txt "${lff[@]}" 95 tar --append -f ${h}/${s}/extract_${e}.tar --files-from=${e}_new.txt "${lff[@]}"