1827315 Members
5416 Online
109961 Solutions
New Discussion

Gaps in Sequence?

 
Robie Lutsey
Frequent Advisor

Gaps in Sequence?

Hello all Hp-UX gurus! I have a question related to my previous post (http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x6b639c196a4bd71190080090279cd0f9,00.html)

I have this directory with (now) over 100000 images all named in order. Now I am missing some 16000. What can I do to find the gaps and spit them out to a file or something. I thought about making a huge list then doing a diff on the lists but that seem terribly slow and just.... well wrong. Please help me. Thanks!!
3 REPLIES 3
A. Clay Stephenson
Acclaimed Contributor

Re: Gaps in Sequence?

The simple answer could be:

START=1000001
STOP=1100000
I=${START}
while [[ ${I} -lt ${STOP} ]]
do
FNAME=LV${I}
if [[ ! -r ${FNAME} ]]
then
echo "${FNAME} is missing."
fi
I=$((${I} + 1))
done
If it ain't broke, I can fix that.
Dietmar Konermann
Honored Contributor

Re: Gaps in Sequence?

typeset -Z6 counter=100000
while (($counter < 200000)); do
file=LV${counter}.jpg
[[ -f $file ]] || echo $file missing
((counter=counter+1))
done

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
H.Merijn Brand (procura
Honored Contributor

Re: Gaps in Sequence?

# perl -le'%p=map{$_=>1}<*.jpg>;for("000000".."999999"){exists$p{"$_.jpg"}||print'


assuming the pigs are in the range of 000000.jpg to 999999.jpg

Enjoy, have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn