split large file by string/regex

Martin Dieringer dieringe at zedat.fu-berlin.de
Mon Nov 22 09:28:54 EST 2004


Jason Rennie <jrennie at csail.mit.edu> writes:

> On Mon, Nov 22, 2004 at 09:38:55AM +0100, Martin Dieringer wrote:
>> I am trying to split a file by a fixed string.
>> The file is too large to just read it into a string and split this.
>> I could probably use a lexer but there maybe anything more simple?
>
> If the pattern is contained within a single line, do something like this:

Hmm it's binary data, I can't tell how long lines would be. OTOH a
line would certainly contain the pattern as it has no \n in it... and
the lines probably wouldn't be too large for memory...

m.



More information about the Python-list mailing list