File Manipulation

IN PROGRESS
Bids
22
Avg Bid (USD)
$7 / hr
Project Budget (USD)
$2 - $5 / hr

Project Description:
Program needs to run on Windows 7 Pro: Perl/Cygin/shell/C++ are all fine. Although prefer something readable for easy changes.

I have a remote server constantly streaming CSV data to a port. Something that a netcat can print. I used "nc 10.1.1.150 5200 > input.csv to get the data" High level, it has a 20-30 line header (which can be discarded see my attached file), and then constantly streams readings.

Date Time, Roughness
2013-05-24 20:47:30,0.321
2013-05-24 20:47:30,0.322
2013-05-24 20:47:30,0.314
2013-05-24 20:47:30,0.420
2013-05-24 20:47:31,0.325
2013-05-24 20:47:31,0.326
2013-05-24 20:47:31,0.326
2013-05-24 20:47:31,0.315
2013-05-24 20:47:40,0.000
2013-05-24 20:47:40,0.234
2013-05-24 20:47:40,0.623
2013-05-24 20:47:40,0.123
2013-05-24 20:47:40,0.523
2013-05-24 20:47:40,0.000
2013-05-24 20:47:43,0.123
2013-05-24 20:47:43,0.356
2013-05-24 20:47:43,0.523
2013-05-24 20:47:43,0.231
2013-05-24 20:47:43,0.000
2013-05-24 20:47:43,0.275
2013-05-24 20:47:43,0.123

There will be about 8 readings/lines in about a second. Sometimes as few as 4. sometimes as many as 10. But normally around 8 readings per part. Then a pause of about 2 seconds The normally 8 readings in about a second/part , then a pause of seconds, etc.

Things I need:

1) Don't need any information from the header, it can be skipped
2) A new file for each part. Start a new file whenever:
a) 2 seconds pass without a new reading
b) a 0.000 record is received (don't want the 0.000 in a file)
c) 10 readings are received
3) File name should be "Production YYYY-MM-DD HH-MM-SS.CSV" Basically, the filename should be "Production + the date" making sure it's unique
4) If under 4 readings, skip the file
5) Output format is a | delimited file named "Product 2013-05-24 2013-05-24 20:47:31" using the date format above. Contents are:

START|Production|Production
DATA|Surf_Fin_Meas_1|0.321|0.06|0|-0.050|2|3|Surface_Finish
DATA|Surf_Fin_Meas_2|0.322|0.06|0|-0.050|2|3|Surface_Finish
DATA|Surf_Fin_Meas_3|0.314|0.06|0|-0.050|2|3|Surface_Finish
DATA|Surf_Fin_Meas_4|0.420|0.06|0|-0.050|2|3|Surface_Finish
DATA|Surf_Fin_Meas_5|0.325|0.06|0|-0.050|2|3|Surface_Finish
DATA|Surf_Fin_Meas_6|0.326|0.06|0|-0.050|2|3|Surface_Finish
DATA|Surf_Fin_Meas_7|0.326|0.06|0|-0.050|2|3|Surface_Finish
DATA|Surf_Fin_Meas_8|0.315|0.06|0|-0.050|2|3|Surface_Finish
DATA|Surf_Fin_Meas_MAX|0.420|0.06|0|-0.050|2|3|Surface_Finish
DATA|Surf_Fin_Meas_MIN|0.314|0.06|0|-0.050|2|3|Surface_Finish
DATA|Surf_Fin_Meas_AVG|0.334|0.06|0|-0.050|2|3|Surface_Finish
DATA|Surf_Fin_Meas_RANGE|0.106|0.06|0|-0.050|2|3|Surface_Finish
END|41804.86633

Notes:
1) Line (Start) 1 is static (use as is)
2) Line 2-9(13) the readings from the input file.
a) Field 1 is the word DATA
b) Field 2 is the field name (Surf_Fin_Meas(1--10)
c) Field 3 is the ROUGHNESS measurement from the input file
d) The remaining fields are static
3) The next 4 lines are MAX, MIN, AVG, and RANGE of the roughness
4) The last line is END with the DATE in windows format. The date should be last date of the readings in the input file.
Windows format is:
Integer = Int((Year - 1901) * 365.25) + 366 + DayOfYear
Fraction = (Seconds + (60 * Minutes) + (3600 * Hours)) / 86400
Date = Integer + Fraction
Where DayOfYear for Jan 1 is 1 and Hours for 12:34 AM is 0
e.g. 01-25-1995|14:15:07
Integer = (1995-1901) * 365.25 + 366 + 25
Integer = 34333.50 + 366 + 25
Integer = 34724
Fraction = (7 + (60 * 15) + (3600 * 14))/86400
Fraction = (907 + 50400)/86400
Fraction = 0.5938310185185
Date = 34724 + .59383
Date = 34724.59383

=======================
I'll have a number of upcoming projects. I've paid up to $3000 for a project in the past.

Hours of work: Unspecified Project Duration: < 1 week Skills required:
Anything Goes, C Programming, Data Processing, Perl, Shell Script
Additional Files: input.csv
About the employer:
Verified
Public Clarification Board
Bids are hidden by the project creator. Log in as the employer to view bids or to bid on this project.
You will not be able to bid on this project if you are not qualified in one of the job categories. To see your qualifications click here.


Hire idleswell
$31 / hr
Hours: 5 hr/ week
Hire s17
$22 / hr
Hours: 10 hr/ week
$5 / hr
Hours: 10 hr/ week
Hire mz1
$3 / hr
Hours: 3 hr/ week
Hire codeguild
$16 / hr
Hours: 6 hr/ week
Hire amsak
$3 / hr
Hours: 3 hr/ week
$5 / hr
Hours: 21 hr/ week
Hire bigdragonfly
$11 / hr
Hours: 3 hr/ week
$4 / hr
Hours: 16 hr/ week
$6 / hr
Hours: 15 hr/ week