in reply to Manipulating Binary files
Being paranoid about really big files, I'd probably do:
But setting $/ to be a reference to a block size is a recently added feature so be aware that your version of Perl may not support it yet. In which case you can change <INPUT> to: read(INPUT,$_,4096) - tye (but my friends call me "Tye"){ local $/= \4096; binmode(INPUT); binmode(OUTPUT); while( <INPUT> ) { if( s/^.*?(\x0d\x0a)/$1/s ) { print OUTPUT $_; last; } } print OUTPUT $_ while <INPUT>; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(Ovid) Re: (tye)Re: Manipulating Binary files
by Ovid (Cardinal) on May 14, 2001 at 20:16 UTC | |
by tye (Sage) on May 14, 2001 at 20:23 UTC |