Looking for regex



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






Relevant Pages

  • Regex continuation strangeness
    ... I'm using a regex to detect errors. ... stops working when the var has a continuation. ... expect1.100> set ERROR {\ ... expect1.101> regexp $ERROR $line ...
    (comp.lang.tcl)
  • Problem with a regular expression
    ... The commented out regex is working in that it finds everything from the beginning <script> tag to the ending tag. ...
    (microsoft.public.scripting.jscript)
  • Re: Strings and OR
    ... There are lots of ways to do that, such as a correctly written if, or a switch statement. ... var country_action = { ... In this case, do_this, do_that, and do_other are the names of functions that deal with specific countries. ... Then, when you pull values from the drop down list, you can do this: ...
    (comp.lang.javascript)
  • Re: Looking for regex
    ... What I am trying to accomplish is pull the first temp for each hour. ... foreach $var { ... Rodrick R. Brown ...
    (perl.beginners)
  • Variables in regular expressions
    ... BEGIN {variable= "regex"} ... I'm dragging up a slightly old thread, but this seems to be exactly my ... var = /regex/ ...
    (comp.lang.awk)