Michael Linfield wrote:
> alright im going about this in the blind so ima throw down my whole task
> here and see what ideas you guys throw at me.
> I need to take data from a csv file and throw it onto a graph outputting
> it in various formats. I need the times in the file to correspond with
> the times on the graph, IE  22:30  which would be 10:30pm for those that
> dont know military time. I want to pull out and graph each line such as
> line1 = blah1  line2 = moreblah line3 = differentblah .... doing this
> all with the command line options of things such as start and end dates
> to determine what range of the CSV to use. My initial thoughts were to
> just program in the blind and see what i came up with, and this is what
> i came up with...
> 
> - Basically i grep'd out all the data pertaining to Blah1, that is, each
> line that had Blah1 in it...and shoved it into a seperate file. Did the
> same for blah2 blah3 blah4 ect.. so now i have all these blah files. I
> wanted to graph the lines by pulling the data from each of the blah
> files, so if line1 was Blah1's data..i could direct it as so. 2 problems
> ive run into are as follows
> 1. this isnt option parsed (optparse)
> 2. the plots from Blah1's data didnt match up with the times on the
> bottom of the graph. per'se in the csv that the time for the selected
> dates didnt start at 24:00.
> 3. trying to perform a string parse to pull the date format out
> correctly.
> 
> ###
> Im using ruport to do all of this so far but its proving tedious when
> ive spent 20 hours a day working on it and getting nowhere fast.
> 
> Any ideas to point me in the write direction would be awesome, thanks
> fellas!

I am faced with similar problems. Two words: "relational database". Two
more words: "SQL Cookbook". :)

Seriously, though, you probably ought to put your CSV file into MySql or
PostgreSQL first. You *can* do queries/reporting against a raw CSV by
either brute force (read the whole enchilada into RAM if the enchilada
will fit) or making it a database table via ODBC or some other library.
But that's grossly inefficient when modern databases have query planners
designed for just this sort of thing, and modern reporting tools like
ruport interface to them.

By the way, if you have Oracle, DB2 or SQL Server available, they have
some enhanced SQL functions that make this sort of thing easier. If you
don't, bummer. :)