Do you know the no. of columns that are involved ?
If you do then One approach is
While not EOF read the file
while not column count
read the file and put the data in the other file
(prepend/append comma depending on the detailed logic)
End while Eof
I had similar situation and this is how I went about it.
Hope it helps!