Hi nalu,
You need to learn to indent your code so you (and people trying to help you) can have a better chance of seeing the structure of your code and have a better chance of understanding what it is doing.
Despite what you have said about your code working correctly to find missing dates in the last 10 days in the single date format filenames (and refusing to tell us what operating system and shell you're using), one might guess that you're using an operating system that uses the GNU utilities
date utility, a
sed utility that accepts a
-r option, and a 1993 or later version of
ksh and that your code only works to find missing dates and times (to the second) for the last 5 (not 10) days. One might also guess that since the likelihood of finding a file with a date and time stamp that matches to the second is not high, your code doesn't really work as well as you have indicated or there is something else going on here that you have not explained to us.
And, you have not explained why there are variables like
check_date in your code (which you have said is the entire purpose of your code). And, why do you need all of the complicated reformatting of your
date format string arguments when the strings defining your format string are included in your script (not read from an external source). Why not just define the format string (or strings) in your source to begin with?
You say you want 10 days of dates checked for filenames with 1 date in the filename and for filenames with 2 dates in the filename, but you have not been at all clear about whether you want two separate lists or if you just want one list of dates not included in either filename format.
PLEASE (as RudiC requested in post #2 in this thread):
- tell us what operating system you're using (including the release number),
- tell us what shell you're using (including the version number), and
- tell us clearly what output you hope to produce:
- one list or two lists,
- date match or date and timestamp match,
- do all of the files you want to process have filenames that end with characters in the format YYYY-mm-dd-HHMMSS.txt (i.e. all files end with a date and timestamp for the date you're interested in followed by the string .txt) or are there other filename formats that need to be processed,
- is the number of days to be processed always 10 or is it a parameter to your script, and
- is there anything else that we need to know about what you're trying to do?