On 11/6/07, sivasakthi <[EMAIL PROTECTED]> wrote: > I have one requirement, the file content is following, it is a dynamic > file, > > 1194240905.451 105 127.0.4.56 TCP_MISS/200 2853 GET > cache_object://localhost/info - NONE/- text/plain > 1194240905.452 0 127.0.0.1 TCP_MISS/200 2853 GET > cache_object://localhost/info - NONE/- text/plain > 1194240905.452 0 127.0.0.1 TCP_MISS/200 2853 GET > cache_object://localhost/info - NONE/- text/plain > > > First time read the full file, then store byte position of the line > before the last line read and last line time stamp(eg: 1194240905.452) > in to one temporary file. > > next time first open the temporary file and get the position,time stamp. > open the file and seek the position of last time read and get time stamp > of current line, after comparing that time stamp with already stored > time stamp, if both are equal then doing some calculation..
It sounds as if you really want to know whether the log file has been updated between one invocation of your program and the next. Is that it? (It's helpful to tell us what you want to accomplish, not just how you hope to accomplish it. Storing a byte position into a temporary file is how you want to do something, but you haven't told us what you're trying to accomplish by doing that.) Saving the tell() location of the last line of the log file isn't a reliable way to find that point in the file at a later date, generally, because log files may be rotated. That is, the file with that name on a later date may be a different file altogether; in that case seek() has no hope of finding the right location. Maybe you want to save the last timestamp seen during one invocation, so that the next invocation can continue examining the log from the first timestamp that occurred after that one? If I haven't been able to guess what you're trying to accomplish, please ask again. Good luck with it! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/