in reply to Implementing a parsing rule in a huge data file
Update: simplified a bit more.
A bit simpler than the other suggestions, and it works.
use strict; while( <DATA> ) { if( /^1$/ ) { my $n = 0; ++$n while defined( $_ = <DATA> ) and /^\n$/; $n = 1 if /_____ 2/; print '1', "\n" x $n; } print; } __DATA__ 1 b 1 _____ 2
There are two keys to the simplicity.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Implementing a parsing rule in a huge data file
by thezip (Vicar) on Dec 08, 2006 at 16:39 UTC |