in reply to Text Extraction
This should be close to what you require:
#!/usr/bin/perl use strict; use warnings; open TEST, '<', 'tests.txt' or die "Cannot open 'tests.txt' $!"; open OUTPUT, '>', 'output1.txt' or die "Cannot open 'output1.txt' $!"; my $data; while ( <TEST> ) { if ( /SUBSCRIBER/ .. /NATIONAL/ ) { $data .= $_; next; } if ( length $data && $data =~ /A1/ ) { print OUTPUT $data; $data = ''; } } close TEST; close OUTPUT;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Text Extraction
by JonDepp (Novice) on Feb 05, 2010 at 21:17 UTC |