Cheers,

in a txt-file is a header with a description of what is in the file.I call this the Ref(erence)-file. In this header there are timestamps set, a start-time and a stoptime, these times i take as markers for other files, which have also timestamps in it. These i call the Match(ing)-files.

Conditions:
- When there is a Ref-file, there is at least one Match-file.
- Timestamps are of the form '20040123.041038.000' for both files.
- Ref- and Match-files are distinguishable by their filenames.
- There are multiple Ref-files and Match-files.

To do:
- Find Match-files that overlay the interval of the Ref-file with a ~1-minute tolerance
e.g.
Ref-start 20040123.061032.000 Ref-stop 20040123.071031.000
so i have to look for times overlaying the interval [06:10:32, 07:10:31]
resp. with the tolerance of one minute ~ [06:10, 07:11]
- when found move the Ref-file and Match-files in a folder.



What i have done so far:
- Read the dir which contains Ref-files and Match-files, store in two hashes, according to Ref-type or Match-type, with Filename as the hash-key and the Start/Stoptimes as the hash-value (an array).
- In a loop compare the Ref-Starttime(s) with the Starttimes of all Matchfiles. When there is a match
( Match-Starttime <= Ref-Starttime ) push it in an temp-array . When done, sort temp-array and the temp[0] contains the matching start-Time.


But how to find the stoptime?

My idea:
get the stoptime of the Match-file associated to the starttime as a new Reftime,and repeat the entire loops andsoforth until the condition is satisfied. (uhm...you know what i mean ...?)
But i cannot change the loopvariable at runtime as it is defined in the loop itself, can i ?


So maybe someone could help me with my idea or should i consider a new approach at all.

Thanks,
-Ralf


--
Ralf Schaa
Institut fuer Geophysik und Meteorologie
Universitaet zu Koeln
Zuelpicher Str. 49a
Germany, D-50923 Koeln
Phone: +49 (0)221 470-4035



-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to