J
Jack Wang
This is the code I've written so far.
#!/usr/bin/perl
my $result = "";
while (<>){
if (/---START---/../--END\s---/){
$result.=$_;
}
}
$text="";
$result=~m/^---START---(.*)--END\s---$/s;
$text.=$1;
$text =~ s/\n+/\n/g;
print $text;
This is the text that it should handle (shortened, ........ represents
more data).
---START---
1342A 1O B10/B11
1003 1O B45/Z46
1094 1O F39/F40
1416 1O G37/G38
1007 1O Z33/A34
..........................
.............................
.............................
.....stuff here..........
.....................
4105 4L F31/F32
.......................
......................
--END ---
I want to extract the data betweeen ---START--- and --END ---,
removing any blanklines. However, the above mentioned program would
outputs everything correctly except it leaves a blank line at the top
and I can't figure out why. Thanks for any help!
#!/usr/bin/perl
my $result = "";
while (<>){
if (/---START---/../--END\s---/){
$result.=$_;
}
}
$text="";
$result=~m/^---START---(.*)--END\s---$/s;
$text.=$1;
$text =~ s/\n+/\n/g;
print $text;
This is the text that it should handle (shortened, ........ represents
more data).
---START---
1342A 1O B10/B11
1003 1O B45/Z46
1094 1O F39/F40
1416 1O G37/G38
1007 1O Z33/A34
..........................
.............................
.............................
.....stuff here..........
.....................
4105 4L F31/F32
.......................
......................
--END ---
I want to extract the data betweeen ---START--- and --END ---,
removing any blanklines. However, the above mentioned program would
outputs everything correctly except it leaves a blank line at the top
and I can't figure out why. Thanks for any help!