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...
n00b parsing text file
Moderator: General Moderators
-
infiniteacuity
- Forum Newbie
- Posts: 12
- Joined: Tue Jun 16, 2009 2:48 pm
- Location: Ft. Lauderdale
Re: n00b parsing text file
How are you getting the data? As a text file, XML feed or some other method?
Re: n00b parsing text file
it is a text file, like the one shown in the link.
Re: n00b parsing text file
To write a script to parse such a file isn't that hard, conceptually, but to do so with error trapping to handle anomalies and provide useful data is a pretty ambitious project for an inexperienced programmer. I recommend you have this done by someone who knows how to do it. Believe me, it will cost your organization less than the time you will spend trying to seek help and get something up and running correctly.