split large file by string/regex
William Park
opengeometry at yahoo.ca
Mon Nov 22 14:51:23 EST 2004
Martin Dieringer <dieringe at zedat.fu-berlin.de> wrote:
> 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...
man strings (-o option)
--
William Park <opengeometry at yahoo.ca>
Linux solution for data management and processing.
More information about the Python-list
mailing list