Do you know anyway (script) to check the missing sequence in the unix files or from database side? |
|||
A Whisper"Knowledge is not necessarily wisdom." Proverb from Ancient Egyptian Temple |
![]() All content on this website (including text, photographs, audio files, and any other original works), unless otherwise noted, is licensed under a Creative Commons License |
Lets assume that you have a
Lets assume that you have a file of files number sequences. That file named (list.txt) contain only numbers.
$ more list.txt
1
2
3
4
5
8
10
11
12
13
14
Here the sequence 6, 7 and 9 is missed. How to find the missing sequence? I have tried this script and it works fine:
> complete.txt
sort -nu list.txt > sorted.txt
s=`head -1 sorted.txt`
e=`tail -1 sorted.txt`
while [ $s -le $e ]
do
echo $s >> complete.txt
((s = $s + 1 ))
done
echo "Sequence missed:"
diff sorted.txt complete.txt | grep '^>'
Post new comment