Google Answers Logo
View Question
 
Q: Perl Script to analyze and add data to CSV file ( No Answer,   1 Comment )
Question  
Subject: Perl Script to analyze and add data to CSV file
Category: Computers > Programming
Asked by: wavecrest90-ga
List Price: $15.00
Posted: 09 Mar 2005 15:51 PST
Expires: 08 Apr 2005 16:51 PDT
Question ID: 490420
I'm looking for perl script to analyze a CSV file. Here is a sample of the file.

2-28-2005:2:13 AM,48.2,48.2,100,30.01,0.8,WNW,3.5,-,N/A,,Mist
2-28-2005:2:53 AM,46.0,46.0,100,30.00,0.5,NNW,4.6,-,N/A,Fog,Fog
2-28-2005:3:04 AM,48.2,48.2,100,30.02,3.0,NNW,3.5,-,N/A,,Overcast
2-28-2005:3:53 AM,46.9,46.9,100,30.01,1.0,West,3.5,-,N/A,,Overcast
2-28-2005:4:01 AM,46.4,46.4,100,30.03,0.5,West,4.6,-,N/A,Fog,Fog
2-28-2005:4:35 AM,46.4,46.4,100,30.04,0.8,West,4.6,-,N/A,,Overcast
2-28-2005:4:53 AM,46.9,46.9,100,30.02,0.8,WNW,3.5,-,N/A,,Overcast
2-28-2005:5:01 AM,46.4,46.4,100,30.04,1.5,WNW,3.5,-,N/A,,Overcast
2-28-2005:5:07 AM,46.4,46.4,100,30.04,3.0,Calm,Calm,-,N/A,,Overcast
2-28-2005:5:35 AM,48.2,48.2,100,30.05,5.0,NNW,5.8,-,N/A,,Overcast
2-28-2005:5:53 AM,46.9,46.9,100,30.04,10.0,NW,8.1,-,N/A,,Overcast
2-28-2005:6:53 AM,48.0,46.0,93,30.06,10.0,NNW,5.8,-,N/A,,Overcast
2-28-2005:9:53 AM,50.0,46.4,87,30.13,10.0,North,5.8,-,N/A,,Overcast
2-28-2005:11:06 AM,51.8,46.4,82,30.13,10.0,Variable,3.5,-,N/A,,Scatt
2-28-2005:2:53 PM,60.8,48.2,63,30.06,10.0,Calm,Calm,-,N/A,,Scattered
2-28-2005:3:47 PM,60.8,46.4,59,30.05,10.0,Variable,3.5,-,N/A,,Clear

It essentially shows cronological weather data. What I'm interested in
would be to analyze each line and compare time stamps and come up with
a diff between the time. So for these two lines of the CSV.

2-28-2005:2:53 PM,60.8,48.2,63,30.06,10.0,Calm,Calm,-,N/A,,Scattered
2-28-2005:3:47 PM,60.8,46.4,59,30.05,10.0,Variable,3.5,-,N/A,,Clear

I would like an additional column that says 54 min have passed and do
this for each and every line within the CSV, the files vary in size,
some have 5000 lines some have 150000. AFter the last record I would
then like to sum up all the minutes or hours, each would be
acceptable.

So with the additional column added for time diff, I also need some
columns which determine whether or not column #6 is less than or equal
to 2,1,0.5,0.3,0.1, and 0, If they are >2 I dont really care. So for
each row.

If total time was say 8000 hours, and this row represented 54 minutes
of that 8000 hours it would be about 0.01125% of the total time. I want
to track the percentages when that column is a specific values, i.e.
2,1,0.5,0.3,0.1 and 0, then add the percentages up at the end to get a
total time within that given range.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Perl Script to analyze and add data to CSV file
From: triniman13-ga on 05 Apr 2005 12:31 PDT
 
I can do this pretty easily. Let me know jason ## quickbrowse.com

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy