So I have been working with a csv export for a few days now and I have the data almost in the form I need it in. I need some advice on how best to proceed to get to the soltuion I need.

Here is the problem:

My csv export contains multiple rows (over 2000) of data in this format:


and I need to convert groups of three rows into one single line like this:


I have researched doing this with PHP and that is my first choice and why Im posting it here, but it looks like Bash and Python might be options as well.

Any thoughts on how you might handle this woukld be greatly appreciated.

I'm not an expert on Python but I do know it has some advantages for this type of problem but to do this trivally in PHP:
Loop through the lines in the csv file (or whatever array you've loaded them into first).
Append each line to a variable (so it becomes line 1 + line 2 + line 3) and then do a modulo check on the loop counter + 1 (because it starts at 0 not 1), if it is evenly divisible by 3, pass the built up string to whatever is storing the final result, reset the variable and loop again.