82 2 22 1043 54.7 48.020 114.037 17.5 3.2 2.9 13 177 84.3 0.20 1.6 2.7 C MBMG * 3.1 KALISPELL VALLEY; FELT 3.07
82022210
BUT EP4432.804ES60.7
LRM IPD4435.40 IS67.2 180.
AMM IPD4429.50 ES57.3 133.
MSO EPC4415.90 ES32.3
CMT EP4430.50 IS58.3
LDM IPC4412.20 ES24.3 3
RXF EPC4414.3
CLX IPC4408.70 ES19.7
####
13
BUT 4432.804 60.7
LRM 4435.40 67.2
AMM 4429.50 57.3
MSO 4415.90 32.3
CMT 4430.50 58.3
LDM 4412.20 24.3 3
RXF 4414.3
CLX 4408.70 19.7
1043 54.7 114.037 48.020 17.5 3.2 177
####
use strict;
use warnings;
my $fin = "SELECTDAT2";
my $fout = "myfile";
open my $ih, '<', $fin or die "cannot open $fin for reading, $!";
open my $oh, '>', $fout or die "cannot open $fout for writing, $!";
sub events {
my @tokens = split;
my $header = $tokens[0];
my ($n, @list);
($n, @list) = @_;
my (@list);
foreach $_ (@list) {
my @tokens = split;
my @list = @tokens[0,3,4,7,8];
if ($_ > my $header) {
push (@list, $_);
}
return @list;
}
}
while (<$ih>) {
chomp;
my @tokens = split;
my $header = $tokens[0];
my @records = @tokens [3,4,5,6,10,11];
return @records;
my $y = $tokens[0];
my $m = $tokens[1];
my $d = $tokens[2];
my $h = $tokens[3];
events;
}
print $oh events(), "\n", @$_ for sort {$a->[3] <=> $b->[3]} @records;
close ($oh);
close ($ih);