How to parse data in a text file?
I propose this, more direct to code (in java, c, etc.)


read each line (until CR/LF)
at begining, read a number, until spaces => number n
after that, take next characters of line 
split them by , 
for each, trim (delete space before or after) => strings s1, s2, s3
then output n s1  CRLF n s2 CRLF n s3, etc.