in reply to How to extract certain range of text and write into another file?
Tell Perl that your records are terminated by ".EON\n\n".
use Modern::Perl; { local $/ = ".EON\n\n"; while ( my $record = <DATA> ) { say "I found: $record"; # ... now do something with $record ... } } __DATA__ $ NAME : corry $$.Inc s d $$.Oc s $$.TO G1 ty n1 EE EE M T1 T2 $$SRU G2 n1 y OO OO M T3 T4 $$SRU .EON $ NAME : patrick $$.Inc c d $$.Oc c $$.TO G1 td n3 EE EE M T5 T6 $$SRU G2 n3 y OO OO M T7 T8 $$SRU .EON
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
My blog: Imperial Deltronics
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How to extract certain range of text and display it?
by annel (Novice) on Oct 14, 2013 at 01:43 UTC | |
by soonix (Canon) on Oct 14, 2013 at 08:45 UTC | |
by annel (Novice) on Oct 15, 2013 at 05:34 UTC | |
by soonix (Canon) on Oct 15, 2013 at 08:44 UTC | |
by Anonymous Monk on Oct 15, 2013 at 06:48 UTC | |
by annel (Novice) on Oct 15, 2013 at 07:30 UTC | |
| |
by jakeease (Friar) on Oct 14, 2013 at 07:21 UTC |
In Section
Seekers of Perl Wisdom