#!/usr/bin/perl -w use strict; =head1 This script filters the particular pct3 file format to a format specified by the client. It is completely ad hoc. =cut my $header = ''; my $data = ''; my $calm_value; # while ( ) { while ( <> ) { # print $_; if ( m/^Teller windset (\d), (.*)/ ) { ## print replacment header $header = <<"ENDHEADER" Teller Airport Improvements 2002-2004, $2 -1 -1 -1 15 0.00 8.5 12.5 15.5 18.5 24.5 31.5 38.5 45.5 ENDHEADER } if ( m/^ N\s+(\d.*\d )/ ) { $data .= " $1\n"; } if ( m/^[ NSEW]{3}\s+(\d.*\d )/ ) { $data .= " $1\n"; } if ( m/^Calm (.*)/ ) { $calm_value = " $1"; } } die "no calm value found \n" unless $calm_value; print $header, $calm_value, $data; =pod Teller Airport Improvements 2002-2004 -1 -1 -1 15 0.00 8.5 12.5 15.5 18.5 24.5 31.5 38.5 45.5 39.312 1.931 1.585 1.048 0.989 0.160 0.053 0.011 0.000 1.574 1.388 1.058 0.883 0.191 0.027 0.016 0.000 2.186 1.314 0.665 0.489 0.096 0.053 0.000 0.000 2.665 1.553 0.888 0.654 0.245 0.101 0.032 0.000 3.526 2.122 1.425 0.979 0.410 0.074 0.000 0.000 2.144 0.936 0.660 0.431 0.122 0.016 0.005 0.000 0.989 0.362 0.245 0.271 0.165 0.085 0.037 0.021 0.543 0.457 0.505 0.824 0.532 0.191 0.037 0.027 0.675 0.622 0.585 0.973 0.495 0.160 0.032 0.005 1.308 1.037 0.814 0.872 0.154 0.016 0.011 0.011 1.558 0.973 0.590 0.543 0.048 0.005 0.000 0.000 0.856 0.250 0.133 0.064 0.000 0.000 0.000 0.000 0.931 0.160 0.048 0.037 0.000 0.000 0.000 0.000 0.633 0.176 0.144 0.144 0.043 0.005 0.000 0.000 0.633 0.431 0.319 0.415 0.133 0.027 0.000 0.000 1.165 0.989 0.739 0.622 0.096 0.011 0.000 0.000 =cut __END__ Teller windset 1, all data wind data from file - 1 records culled records skipped: dir_over_range=2, Percent Frequency Dir 8.5 12.5 15.5 18.5 24.5 31.5 38.5 45.5 All N 1.966 1.674 1.144 1.096 0.179 0.060 0.012 0.000 6.129 NNE 1.698 1.477 1.173 0.983 0.214 0.030 0.018 0.000 5.593 NE 2.299 1.441 0.745 0.548 0.107 0.060 0.000 0.000 5.200 ENE 2.752 1.632 0.989 0.733 0.274 0.113 0.036 0.000 6.528 E 3.651 2.228 1.525 1.096 0.459 0.083 0.000 0.000 9.042 ESE 2.263 1.042 0.709 0.482 0.137 0.018 0.006 0.000 4.658 SE 1.036 0.375 0.244 0.298 0.185 0.095 0.042 0.024 2.299 SSE 0.482 0.429 0.465 0.697 0.518 0.203 0.042 0.030 2.865 S 0.608 0.482 0.500 0.846 0.453 0.173 0.036 0.006 3.103 SSW 1.114 1.013 0.786 0.780 0.155 0.018 0.012 0.012 3.889 SW 1.382 0.905 0.512 0.494 0.048 0.006 0.000 0.000 3.347 WSW 0.727 0.155 0.095 0.071 0.000 0.000 0.000 0.000 1.048 W 0.834 0.155 0.054 0.042 0.000 0.000 0.000 0.000 1.084 WNW 0.524 0.185 0.161 0.161 0.048 0.006 0.000 0.000 1.084 NW 0.613 0.471 0.357 0.465 0.149 0.030 0.000 0.000 2.085 NNW 1.245 1.078 0.810 0.697 0.107 0.012 0.000 0.000 3.949 All 23.194 14.742 10.269 9.488 3.032 0.905 0.203 0.071 61.904 Calm 38.096 Total Observations: 16789 --------- the following records were culled as invalid: 2004,19,600,4.784,721 -- ERROR: dir over range 2004,37,1800,10.44,514.9 -- ERROR: dir over range ---------