Cropping log files
Gerrit Holl
gerrit at nl.linux.org
Wed Dec 17 07:28:21 EST 2003
Robin Munn wrote:
> Or if you really want to do it in pure Python, then have a look at the
> source for 'tail' and see how it finds the last N lines. In most of my
> experiments, I've found that 'tail' grabs the last 10 lines out of a
> 1-gigabyte log file within milliseconds, while 'wc -l' takes a lot
> longer to count the whole file. That's not very scientific evidence, of
> course, but why don't you try it and see for yourself?
Maybe it .seeks() to .getsize()?
Gerrit.
--
258. If any one hire an ox-driver, he shall pay him six gur of corn per
year.
-- 1780 BC, Hammurabi, Code of Law
--
Asperger's Syndrome - a personal approach:
http://people.nl.linux.org/~gerrit/english/
More information about the Python-list
mailing list