I have a .csv file that has been create from a google form and I need to extract the data from it that has been entered by users.
The CSV will have anywhere between 100 and 1000 lines which comprise entr data for a sports carnival
A few typical line is shown here to show the problem I have
26/10/2015 11:58:26,KL,,22,name1,name2,F,9,,,,,,,,,70,100,200,400,,,,,
26/10/2015 12:01:28,KL,,22,name3,name4,F,8,70,100,200,700s,,,,,,,,,,,,,
26/10/2015 12:01:28,KL,,22,name5,name6,F,8,,,,,,,,,,,,,,HJ,LJ,DT,SP,
From this data, I need to extract the data in the last part of the lines,
This data can be Alpha or numeric or combination of and between 2-4 chanractes in length. It could be in any position within the last blank fields.
there could be anywhere between 1 and 6 entries on each line that ineed to capture.
For each entry, I need to write out a single formatted line which I already have most of in the form
D;Name2;name1;;F;;KIN;KL;9;;70;;M;1;22;;;;
D;Name2;name1;;F;;KIN;KL;9;;100;;M;1;22;;;;
D;Name2;name1;;F;;KIN;KL;9;;200;;M;1;22;;;;
D;Name2;name1;;F;;KIN;KL;9;;400;;M;1;22;;;;
How do I capture to a variable, The Last data on each line from random positions and then proceed to the next line when done?
I am stumped!
Thanks in advance
Ken
---------- Post updated at 04:20 PM ---------- Previous update was at 03:51 PM ----------
I had thought of using cut to query the first Column to test ( cut -d , -f9 ), if it has a non zero value, then must have data so write line, and then increment column and test again.
If value = LF? then proceed to next line
is there a better way that interativley testing each column?
Ken