Regarding points 4 and 5 in the response from
sundialsvc4, if an "end-of-record" identifier can be isolated (nickname in this case), then there is no need to do a separate write for accumulated values at end-of-file, or add logic for the first "start of record" line (where the accumulated values would be empty).