Re: skipping a repeated header

2009-05-27 Thread Kirk Wythers
t_Avg2, $S_RXResponse, $Wind_RXResponse, $I_WS_MS ), "\n"; } __END__ On May 27, 2009, at 10:42 AM, Wagner, David --- Senior Programmer Analyst --- CFS wrote: -----Original Message- From: Kirk Wythers [mailto:kwyth...@umn.edu] Sent: Wednesday, May 27, 2009 09:31 To: beginne

skipping a repeated header

2009-05-27 Thread Kirk Wythers
I have a large datafile that I am trying to read into a postgresql database. I think I have the db_connect stuff down, but I'm fighting with the part that reads the file to be processed. The file contains a repeating structure of header lines like this: TOA5B4WARM_CCR1000 16474

trouble with a regular expresion

2008-10-23 Thread Kirk Wythers
Below is snipit of code that is intended to read in the station_id from the header of each example file. In each case the reg expression is supposed to find the 6 digit number within the parentheses. Both files contain 6 lines in the header. For some reason the reg expression will not catch

Re: aggregating time steps

2007-08-24 Thread Kirk Wythers
Thank you very much for the explanation Chas. It is starting to make more sense. The reason I was attracted to the solution #! /usr/bin/perl -w use strict; use warnings; $, = ' '; # set output field separator $\ = "\n"; # set output record separator my ( $year, $month, $doy, $tmax, $tmin, $

Re: aggregating time steps

2007-08-24 Thread Kirk Wythers
On Aug 23, 2007, at 11:17 PM, Gunnar Hjalmarsson wrote: Kirk Wythers wrote: I don't see how $totals{$year}{$month}{count} ++; is holding the count. Read about the auto-increment operator in "perldoc perlop". OK. I'll try and be more clear to the degree of my ignoranc

Fwd: aggregating time steps

2007-08-23 Thread Kirk Wythers
Begin forwarded message: On Aug 23, 2007, at 4:25 PM, Mr. Shawn H. Corey wrote: # How about? my ( $year, $month, $doy, $tmax, $tmin, $par, $precip, $NH4, $NO3, $O3, $CO2, $V1, $V2, $V3, $V4 ) = split; # You can now store your totals by month as: $totals{$year}{$month}{tmax} += $tmax; .

aggregating time steps

2007-08-23 Thread Kirk Wythers
Sorry for the "not sure where to even begin" nature of this email, but I am stuck. I am trying to put together a aggregating script that takes daily climate data and produces monthly averages. For example, the input file has the form: year month doy tmax tmin par precip NH4

Re: run script on multiple files

2006-12-24 Thread Kirk Wythers
On Dec 24, 2006, at 2:59 AM, John W. Krahn wrote: Yes I saw where you tested $year but since I don't have the actual data to test with I had to guess, and I guess I guessed wrong. :-) I thought you did an amazing job at guessing what I intended without being able to look at a datafile

Re: run script on multiple files

2006-12-23 Thread Kirk Wythers
On Dec 23, 2006, at 9:25 PM, Chris Charley wrote: - Original Message - From: "Kirk Wythers" <[EMAIL PROTECTED]> Newsgroups: perl.beginners To: "John W. Krahn" <[EMAIL PROTECTED]> Cc: "Perl Beginners" Sent: Saturday, December 23, 2006 1:32 PM

Re: run script on multiple files

2006-12-23 Thread Kirk Wythers
Thanks or the reply John. I have a couple of questions inline. On Dec 22, 2006, at 10:53 PM, John W. Krahn wrote: #! /usr/bin/perl -w use strict; use Date::Calc qw(Day_of_Year); use DBI; #MICIS climate data munger. Required input argument is the file to process. #Use > to redirect output to n

Re: run script on multiple files

2006-12-22 Thread Kirk Wythers
On Dec 22, 2006, at 8:33 PM, Chad Perrin wrote: On Fri, Dec 22, 2006 at 08:04:39PM -0600, Kirk Wythers wrote: I have written a short perl script that munges climate data and then loads it into a postgres database. It works fine on one file at a time... syntax is ./program.pl filename I would

run script on multiple files

2006-12-22 Thread Kirk Wythers
I have written a short perl script that munges climate data and then loads it into a postgres database. It works fine on one file at a time... syntax is ./program.pl filename I would like to run it in a directory with multiple files. I have tried syntax ./program.pl file1 file2, but only th