This is certainly a move in the right direction and the date part is superb !, but it gives me the problem that the variable message at the end gets split up into an indeterminate number of csv values where if it were at least quoted I could read that as one field as the commas inside the quotes would be ignored ( I think )

As I wanted the remainder to be in double quotes so it would read in as one field. The problem is that remainder sometimes already contains double quotes which I would like to remove or replace with single quotes

I tried the following but it leaves be with an empty set of double quotes

The user=<gonenow>, etc etc case can probably be got around with a couple of minor changes to the code. The user=gonenow sent=34 recv=34 is more of a problem as it fails the premise on which the split approach was based. I'd probably wrap the original code in an if condition and deal with the non-comma-separated lines in an else clause.

It just so happens that I am about to go on holiday so I will not be able to provide further help for a week or so. I suggest you create another question in SoPW, linking to this thread, and post some example data lines illustrating your problem so that others can perhaps help you build on the solution you have so far.

When putting a smiley right before a closing parenthesis, do you:

Use two parentheses: (Like this: :) )
Use one parenthesis: (Like this: :)
Reverse direction of the smiley: (Like this: (: )
Use angle/square brackets instead of parentheses
Use C-style commenting to set the smiley off from the closing parenthesis
Make the smiley a dunce: (:>
I disapprove of emoticons
Other