Find missing sequence

Hi,

I need to find out the missing sequence from a list. However the issue is there is not a fixed start and end, it depends on the generation of files.

For eg, it might start with 4000 and end with 9000.

Based on this, I need a script which greps the start and end sequence from the file and then does its calculations and tells me which sequence is missing.

Can someone please guide me to it. Iv tried searching on Google but never really could get the exact thing

This is vague - we need a simple example. input; expected output.

  1. is the "list" a file or do you have to create it? If already there is the the file accurate?
  2. So when the list is available you simply go to the directory and check all the files in the list and note the missing ones, or do you look for gaps like: 1001 1002 1004 1005 (1003 is missing). So are we working against directory contents or the file -- or both?
  1. List is a file which contains sequence numbers. I extract it form a DB.

(Actually we have hundreds/thousands of files coming in, we record this information in a DB. This List is extracted from the DB using the substr function.)

  1. We want to put a logic on this List to find the missing sequence. Attached is a sample List

  2. The intention is to inform the source that a file with the following sequence has not been received.

Please let me know if any more information is required

There can be sequence resets also so you may find more than one occurrence of the same sequence at different times

Solutions to similar problems have been posted umpteen times in these forums, e.g. here.