Best Way to Parse a Text File...
Posted on 2004-11-01
I'm wondering what would be the BEST way to parse a file. I've come up with 3 ideas.
1) Read File Line by line and parse each line specifically (INSTR, or Regular expressions)
This just seems like it should be slow..
2) Read in whole file, and use INSTR or regular expressions to parse for data.
Faster then #1..but I would think 3 would be the fastest.
3) Read in whole file, and use Regular Expressions to find, store, and then remove each match in the file
saving the Temp File as the routine goes, So the next parse would be even faster since there's not
as much log to search though.
I'm looking for suggestions, ideas, and/or code for the fastest and most reliable way to parse a file.
The project that I'm designing would require the parse of MULTIPLE items in the file, and saving the
parsed data into a database, and to return unused (IE unknown) line items.