in reply to Parsing 12GB Entourage database in pieces...

Since your data of interest never has nulls in it but always has nulls between them, I'd say set $/ to that and go to it.

$/ = "\0\0"; while (<>) { chomp; if ( m{ \A MSrc .{16} (.+) \z }xms ) { # message in $1 } }

Does that work?

Replies are listed 'Best First'.
Re^2: Parsing 12GB Entourage database in pieces...
by moritz (Cardinal) on Aug 28, 2008 at 19:22 UTC
    Since your data of interest never has nulls in it

    remember that the 16 bytes of binary data could contain "\0\0", and every time this actually happens one looses that message with your method.

      Hmmm, good point. Maybe...

      $/ = "\0\0"; while (<>) { $_ .= <> while ( ! eof && length() < length("MSrc$/")+16 ); # if ... }