in reply to tailing the file and look for string
My blunt ... but, by no means intended to be “blunt” ... take on this is that:
You seem to have forgotten that Perl is a full-featured programming language ... not an over-glorified [Bash ...] script. “Instead, Plan Accordingly.™”
For example: “tailing a file” simply means: seek( filehandle, distance, SEEK_END). Nothing more, nothing less, no matter how “big” the file in-between might be. We’ve been doing this sort of thing for random-access disk files since, uhh, the 1950’s. Thus, the Perl programming language is quite able to solve this problem without resorting to any sort of “bash-script hack” metaphors ... and, so, you should do the same.
(No, I am not trying to make fun of you in a public place!!! Please, let us herewith “put any egos aside,” and speak frankly as though we were not in-public. I have no way of speaking that is not public. “But, I digress™ ...”)
To solve your problem, you simply need to read “some n bytes” from the SEEK_END of the file in question, then use ordinary regular-expression logic against the buffer thusly obtained, in a loop, choosing the last match that you may find in such a loop, and taking a calculated risk that you didn’t happen to choose exactly the wrong starting-point.
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: tailing the file and look for string
by user786 (Sexton) on Aug 06, 2014 at 02:20 UTC | |
by GotToBTru (Prior) on Aug 06, 2014 at 14:04 UTC | |
|