Re: Looking for regex

2008-01-28 Thread obdulio santana
I offer you a solution and my comments why use hash of 24 elements? using a hash may brings some problem because if file is the joined day+day you finally get a file corresponding for example a month (I use these kind of reports of automatic station) you can face this situation 2007-01-23 00:

Re: Looking for regex

2008-01-26 Thread Chas. Owens
As a side note, you may want to use the everything up to and including the hour if your file can cover a time period longer than 24 hours: #! /usr/bin/perl use strict; use warnings; my %seen; while (my $line = <>) { print $line unless $seen{substr $line, 0, 13}++; } -- To unsubscribe,

Re: Looking for regex

2008-01-26 Thread John Kufrovich
It worked! I'll have to digest what you did, this evening. It's been raining for over a week and the sun is finally out so, I have to take care of some yard work. Thanks again, Chas! T "Chas. Owens" <[EMAIL PROTECTED]> wrote: On Jan 26, 2008 1:13 PM, John Kufrovich wrote:

Re: Looking for regex

2008-01-26 Thread Gunnar Hjalmarsson
John Kufrovich wrote: Chas. Owens wrote: my %seen; while () { my ($hour, $temp) = / (..).*?,(.*?),/; print "temp was $temp at $hour\n" unless $seen{$hour}++; } __DATA__ 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

Re: Looking for regex

2008-01-26 Thread Chas. Owens
On Jan 26, 2008 1:13 PM, John Kufrovich <[EMAIL PROTECTED]> wrote: > Chas, > Thanks for the help. I'm not expert but I think your code will output each > line. snip You don't have to be an expert to run the code and see what it does (it only prints out the hour and temp for the first instance of

Re: Looking for regex

2008-01-26 Thread John Kufrovich
Chas, Thanks for the help. I'm not expert but I think your code will output each line. The output I'm trying to achieve. --Output--. h:m:s 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 01:11:00,42.9,34.8,30.13,Nort

Re: Looking for regex

2008-01-26 Thread Chas. Owens
On Jan 26, 2008 11:29 AM, Jerald Sheets <[EMAIL PROTECTED]> wrote: > Note that on that particular kind of feed, you *can* have three digits > on occasion. > > How would you go about allowing for the third digit if and only if it > exists? > > I had the first regex, but I'm not sure where the allowa

Re: Looking for regex

2008-01-26 Thread Jerald Sheets
Note that on that particular kind of feed, you *can* have three digits on occasion. How would you go about allowing for the third digit if and only if it exists? I had the first regex, but I'm not sure where the allowance for the third digit would come in, or how to allow for a random ser

Re: Looking for regex

2008-01-26 Thread Chas. Owens
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, snip > What I am trying to accomplish is pull the first temp for each hour. I >

Re: Looking for regex

2008-01-26 Thread Rodrick Brown
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

Re: Looking for regex

2008-01-26 Thread Rodrick Brown
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

Looking for regex

2008-01-26 Thread John Kufrovich
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,Wunde