RE: How to find the beginning of last line of a big text file ?

2009-01-04 Thread Barak, Ron
Hi Tim, Thanks for the solution (and effort), and for teaching me some interesting new tricks. Happy 2009! Ron. -Original Message- From: Tim Chase [mailto:python.l...@tim.thechases.com] Sent: Thursday, January 01, 2009 20:04 To: Sebastian Bassi Cc: python-list@python.org Subject: Re:

How to find the beginning of last line of a big text file ?

2009-01-01 Thread Barak, Ron
Hi, I have a very big text file: I need to find the place where the last line begins (namely, the offset of the one-before-the-last '\n' + 1). Could you suggest a way to do that without getting all the file into memory (as I said, it's a big file), or heaving to readline() all lines (ditto) ?

Re: How to find the beginning of last line of a big text file ?

2009-01-01 Thread Sebastian Bassi
On Thu, Jan 1, 2009 at 2:19 PM, Barak, Ron ron.ba...@lsi.com wrote: I have a very big text file: I need to find the place where the last line begins (namely, the offset of the one-before-the-last '\n' + 1). Could you suggest a way to do that without getting all the file into memory (as I said,

Re: How to find the beginning of last line of a big text file ?

2009-01-01 Thread MRAB
Barak, Ron wrote: Hi, I have a _very_ big text file: I need to find the place where the last line begins (namely, the offset of the one-before-the-last '\n' + 1). Could you suggest a way to do that without getting all the file into memory (as I said, it's a big file), or heaving to

Re: How to find the beginning of last line of a big text file ?

2009-01-01 Thread Tim Chase
Sebastian Bassi wrote: On Thu, Jan 1, 2009 at 2:19 PM, Barak, Ron ron.ba...@lsi.com wrote: I have a very big text file: I need to find the place where the last line begins (namely, the offset of the one-before-the-last '\n' + 1). Could you suggest a way to do that without getting all the file