有文本内容结构类似如下:
Year: 2011
Month: 3
Version: 201103A STUDENT
Number: 1
Gender: male
Class: A
Advance: yes STUDENT
Number: 5
Gender: female
Class: A
Advance: yes
Special: A STUDENT
Number: 16
Gender: male
Class: B
Advance: no
Special: 9 STUDENT
Number: 17
Gender: male
Class: A
Advance: yes
END
每个STUDENT段包含Number, Gender, Class, Advance, Special这些行。其中前面4个必有,Special这行可能没有。
现希望经过操作后,将每个STUDENT信息合并成一行,如下
Number: 1, Gender: male, Class: A, Advance: yes
Number: 5, Gender: female, Class: A, Advance: yes, Special: A
Number: 16, Gender: male, Class: B, Advance: no, Special: 9
Number: 17, Gender: male, Class: A, Advance: yes
Year: 2011 Month: 3 Version: 201103A STUDENT
Number: 1 Gender: male Class: A Advance: yes STUDENT
Number: 5 Gender: female Class: A Advance: yes Special: A STUDENT
Number: 16 Gender: male Class: B Advance: no Special: 9 STUDENT
Number: 17 Gender: male Class: A Advance: yes END