G
Gilbert Rebhan
Hi,
i need some ideas before i'll get my feet wet.
Situation =
i have to parse n logfiles from one whole day.
Those logs have lines with a filename and 1 of 3
possible attributes, i.e format simplified :
Updated ... path/to/file ...
New ... path/to/file ...
Deleted ... path/to/file ...
OK, parsing with regular expressions works fine,
i get the attribute and the filename.
Problem =
It may occur that one file occurs with attribute
Deleted in a log, but in the next log it appears
with New again.
I need a structure / collection i write the filename
with the attribute to and make sure, if it appeared
already, it isn't saved a second time.
My idea =
i have to start from the last log, reading the most
recent log, as the last appearence of a file attribute
should win/ is the valid one, i.e.
FileA appears in last log with attribute New|Updated, so i
write FileA with New/Updated or copytrue in my collection.
Then reading the next log, if FileA appears again with Deleted
i have to skip it.
So need a routine that starts from the most recent logfile,
writes the filename + attributes into a collection and
checks when reading the next log, if filename already
is saved, if yes ignore, if no save with attribute.
Questions =
What kind of collection is best for that purpose ?
Thanks for any hint!!
Regards, Gilbert
i need some ideas before i'll get my feet wet.
Situation =
i have to parse n logfiles from one whole day.
Those logs have lines with a filename and 1 of 3
possible attributes, i.e format simplified :
Updated ... path/to/file ...
New ... path/to/file ...
Deleted ... path/to/file ...
OK, parsing with regular expressions works fine,
i get the attribute and the filename.
Problem =
It may occur that one file occurs with attribute
Deleted in a log, but in the next log it appears
with New again.
I need a structure / collection i write the filename
with the attribute to and make sure, if it appeared
already, it isn't saved a second time.
My idea =
i have to start from the last log, reading the most
recent log, as the last appearence of a file attribute
should win/ is the valid one, i.e.
FileA appears in last log with attribute New|Updated, so i
write FileA with New/Updated or copytrue in my collection.
Then reading the next log, if FileA appears again with Deleted
i have to skip it.
So need a routine that starts from the most recent logfile,
writes the filename + attributes into a collection and
checks when reading the next log, if filename already
is saved, if yes ignore, if no save with attribute.
Questions =
What kind of collection is best for that purpose ?
Thanks for any hint!!
Regards, Gilbert