n00b parsing text file
Posted: Mon Aug 10, 2009 2:24 pm
I am not really a CS person, but I have a task to import a non-delimited text to an access database. After some research, I *think* the best way to do this is by first converting the non-delimited text to delimited text, and then import it to the database.
thus I need to write a parser and use something as delimiters (I am thinking of a |)
An example of the text file is posted at http://pastebin.com/f4e0ef4ba
Line 1 is useless, so the program would start at line 2.
Basically, from line 2 to 8 contains a person's standard information, starting in line 9, custom comments/info are placed in the <tags>. After the last tag <stop_com>, another person's standard information would come up in the first 7 lines, and then the tags would repeat.
Ultimately, I need to get the text to convert to something that looks like this.
last name | First name| Medical num | birth date| sex| ID | blood grp| phenotype| TR| AB| AG| Comment| ...
Any help on getting me started on this is appreciated. I know how php works, but is very very limited in the actual programming...
thus I need to write a parser and use something as delimiters (I am thinking of a |)
An example of the text file is posted at http://pastebin.com/f4e0ef4ba
Line 1 is useless, so the program would start at line 2.
Basically, from line 2 to 8 contains a person's standard information, starting in line 9, custom comments/info are placed in the <tags>. After the last tag <stop_com>, another person's standard information would come up in the first 7 lines, and then the tags would repeat.
Ultimately, I need to get the text to convert to something that looks like this.
last name | First name| Medical num | birth date| sex| ID | blood grp| phenotype| TR| AB| AG| Comment| ...
Any help on getting me started on this is appreciated. I know how php works, but is very very limited in the actual programming...