in reply to Re: Parsing logs and bookmarking last line parsed
in thread Parsing logs and bookmarking last line parsed
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Parsing logs and bookmarking last line parsed
by Marshall (Canon) on Aug 19, 2010 at 20:03 UTC | |
I'm actually not sure that you need this concept at all. If you just need the last data for each backup set, then I would process the input file, replacing old info with new as it becomes available. Then the output becomes "hey here is the most recent stuff I have". All of this processing will be so fast that there is no need to keep track of what you did before, just do it all again to keep things simple. I mean there are 86,400 seconds in a day and running a program once per day that takes one second is nothing in the scheme of things! The problem I came into was that the data for each backup set doesn't appear to be "symmetric". In other words, sometimes some parm values are "missing". This can cause some previous value to continue to be "carried forward" when that is not the right thing to do. Rather than getting into some "spec war", I post a simple minded use of my previously posted code to report "last values" of each set and then you can tell me: "Hey this would have been right if it had of done X". Below I didn't use $date, don't know why you need $date. In doing this short thing, I noticed that $param could have a leading space, so I changed a regex.
| [reply] [d/l] |
|
Re^3: Parsing logs and bookmarking last line parsed
by dasgar (Priest) on Aug 19, 2010 at 19:08 UTC | |
If you're ok with the idea of recording to a file the last time stamp that was used, it should be pretty simple to record which line you were last on too. You'll just need to modify your while loop a bit by adding a variable to keep track of the line numbers. For a simple illustration, let's say that you read in from your new assistant file the last time stamp and the last line number read. Let's say that the last line read was stored in the variable $last_line_read. The code below illustrates the modification that you would need to do.
I'm not saying that this is the "best" way to do it, but it should work. | [reply] [d/l] [select] |
by JaeDre619 (Acolyte) on Aug 21, 2010 at 17:18 UTC | |
My question now is how can I use this as a place holder to start the regex the next time I run the script? I don't know if my logic works currently as I am grabbing data based on a given date, so I'm not sure if a count of record would help? or do you have another idea for a good key? thanks. | [reply] |