#!/usr/bin/perl sub extr($){ my ($file) = @_; $file =~ /\/d([0-9]+).hnf/; my $date = $1; open DF, $file or die "cannot open $file\n"; my $flag = "other"; while (){ if (/^NEW ¹Ô¤­/){$flag = "up";} elsif (/^NEW µ¢¤ê/){$flag = "down";} elsif (/^L?NEW|^CAT/){$flag = "other";} if ($flag eq "other") {next;} if (/([0-9]{2}\.[0-9]+ ?km\/h)/){ printf "%s %4s %s\n", $date, $flag, $1; } } } foreach my $f (@ARGV) { extr($f); }