Laurent_R, Thanks for your reply, the format of original file is not as simple as I showed. it's about 10M size and various types nest in it.(like ^M xxxx, ^D xxxx etc). besides, it's a good chance to learn knowledge of parsing language to me. I want to have a try. ;)
I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction