On Jan 26, 2008 9:38 AM, John Kufrovich <[EMAIL PROTECTED]> wrote:

> Time,TemperatureF,DewpointF,PressureIn,WindDirection
>  2007-01-23 00:01:00,43.3,34.9,30.14,North,359,7,8,72,0.00,,,0.00,Wunderground
> v.1.13,
> 2007-01-23 
> 00:06:00,43.2,34.8,30.14,North,354,11,11,72,0.00,,,0.00,Wunderground
> v.1.13,
> 2007-01-23 00:12:00,43.2,34.8,30.14,North,1,6,9,72,0.00,,,0.00,Wunderground
> v.1.13,
> 2007-01-23 01:11:00,42.9,34.8,30.13,North,1,5,6,73,0.00,,,0.00,Wunderground
> v.1.13,
> 2007-01-23 01:17:00,42.9,34.8,30.12,NNW,346,3,7,73,0.00,,,0.00,Wunderground
> v.1.13,
> 2007-01-23 01:23:00,43.1,35.0,30.12,North,359,5,11,73,0.00,,,0.00,Wunderground
> v.1.13,
>  2007-01-23 02:14:00,43.2,34.1,30.10,North,0,16,16,70,0.00,,,0.00,Wunderground
> v.1.13,
> 2007-01-23 02:19:00,43.2,34.1,30.09,North,0,6,13,70,0.00,,,0.00,Wunderground
> v.1.13,
> 2007-01-23 02:24:00,43.2,33.7,30.09,North,349,8,14,69,0.00,,,0.00,Wunderground
> v.1.13,
> 2007-01-23 03:04:00,43.2,34.1,30.11,North,0,7,12,70,0.00,,,0.00,Wunderground
> v.1.13,
> 2007-01-23 03:09:00,43.2,34.1,30.11,North,0,10,17,70,0.00,,,0.00,Wunderground
> v.1.13,
> .
>  .
>  .
>  2007-01-23 23:00:00,41.9,40.3,30.15,NNE,13,5,7,94,0.08,,,0.35,Wunderground
> v.1.13,
> 2007-01-23 23:05:00,41.9,40.3,30.16,NW,318,0,6,94,0.09,,,0.36,Wunderground
> v.1.13,
> 2007-01-23 23:10:00,41.9,40.3,30.16,North,0,3,6,94,0.10,,,0.37,Wunderground
> v.1.13,
> 2007-01-23 23:15:00,41.9,40.3,30.16,North,3,7,8,94,0.12,,,0.38,Wunderground
> v.1.13,
>
>
>  What I am trying to accomplish is pull the first temp for each hour.  I
> have tried various combinations of regex and none seem to correctly on
> hr:min:sec.
>
>  foreach $var (@testfile) {
>  if ($var =~ /00:[0-1][0-5]:00/) {
>  print $var;
>  # print ("\n$hour:$minute:00\n");
>  $hour ++;
>  $minute=0;
>  #print ("\n$hour:$minute:00\n\n");
>
>  }
>  else {
>  $minute ++;
>  }
> }
>
>  So, I'm bowing to the experts.
>
>  Regards,
>  John
>
>
>
>
>
[EMAIL PROTECTED]:~] $ cat /tmp/data.txt
2007-01-23 00:01:00,43.3,34.9,30.14,North,359,7,8,72,0.00,,,0.00,Wunderground
v.1.13,
2007-01-23 00:06:00,43.2,34.8,30.14,North,354,11,11,72,0.00,,,0.00,Wunderground
v.1.13,
2007-01-23 00:12:00,43.2,34.8,30.14,North,1,6,9,72,0.00,,,0.00,Wunderground
v.1.13,
2007-01-23 01:11:00,42.9,34.8,30.13,North,1,5,6,73,0.00,,,0.00,Wunderground
v.1.13,
2007-01-23 01:17:00,42.9,34.8,30.12,NNW,346,3,7,73,0.00,,,0.00,Wunderground
v.1.13,
2007-01-23 01:23:00,43.1,35.0,30.12,North,359,5,11,73,0.00,,,0.00,Wunderground
v.1.13,
2007-01-23 02:14:00,43.2,34.1,30.10,North,0,16,16,70,0.00,,,0.00,Wunderground
v.1.13,
2007-01-23 02:19:00,43.2,34.1,30.09,North,0,6,13,70,0.00,,,0.00,Wunderground
v.1.13,
2007-01-23 02:24:00,43.2,33.7,30.09,North,349,8,14,69,0.00,,,0.00,Wunderground
v.1.13,
2007-01-23 03:04:00,43.2,34.1,30.11,North,0,7,12,70,0.00,,,0.00,Wunderground
v.1.13,
2007-01-23 03:09:00,43.2,34.1,30.11,North,0,10,17,70,0.00,,,0.00,Wunderground
v.1.13,

[EMAIL PROTECTED]:~] $ perl -nle 'print "$.. " . $_ foreach
(split/,/,$_)[1]' /tmp/data.txt
1. 43.3
2. 43.2
3. 43.2
4. 42.9
5. 42.9
6. 43.1
7. 43.2
8. 43.2
9. 43.2
10. 43.2
11. 43.2

-- 
Rodrick R. Brown
http://www.rodrickbrown.com

Reply via email to