posted 21 years ago
I am working on a project that reads data from text files. Every line in a the file corresponds to different data items. Data is pipe delimited.
I need to read each line and find out which table it maps to and then insert records into that table. I need to automatically pick the files from a particular directory(whenever the file is placed there).
Do you have any ideas how to get started, any sample code from any other project or links.
My data sample is like this.
00|05298258|20020828|20020920|0|7458.63|0.00|0|0.00|0|7458.63|0.00|9140.62|16599.25|20020728|20020928|20020829|||||||||||
01|05298258|TERMS: The past due amount is due immediately.|||
03|05298258| service.|||
10|05298258|| FULTONCOUNTY |ATTN: JO AVELLE|141 SW POR ST #9039||ATLANTA|GA|303033455|111210080|I|R|1||128||||||||||||
11|05298258|0|0|0|5431.06|1850|129.76|101|70.40|128|2066880|417060|2532.67|112440|3840|21.27|161100|2340|12.12|2340420|423240|2566.06|65.04|71580|808.93|51.07|0.00|7.00|18.30|183|0.00|0|0.00|0.00|0.00|0.00|0.00|0|0|0.00|0|0|0|0.00|0||||
20|05298258|4045160216|FUlton OFFICE|141 POR ST|9039|ATLANTA|GA|303033444|111210080|I|FEDSSGOSGISG|99999999|2|||||||||||
21|05298258|4045160216|60.75|0|0|0|58.96|18|1.24|1|0.55|1|8400|0|0.00|0|0|0.00|0|0|0.00|8400|0|0.00|0.00|0|0.00|0.00|0.00|0.00|0.00|0|0.00|0|0.00|0.00|0.00|0.00|0.00|0|0|0.00|0|0|0|0|0|0|0|0|0.00|0|
30|05298258|4045160216|2|5|/HOME 700|49.99|0|20020829|20020928|0|||||||||||
30|05298258|4045160216|3|5|/text BASIC VOICE MAIL NC|0.00|0|20020829|20020928|0|||||||||||
30|05298258|4045160216|3|5|text BASICS|2.99|0|20020829|20020928|0|||||||||||
30|05298258|4045160216|28|6|/HOME 700|16.66|1|20020819|20020828|0|||||||||||
30|05298258|4045160216|45|6|CONNECTION CHARGE|1.24|0|20020829|20020928|0|||||||||||
30|05298258|4045160216|43|10|UNIVERSAL SVC CHARGE|0.55|0|20020829|20020928|0|||||||||||
50|05298258|4045160216|20020729|105508|4045160216||INCOMING|CL||P|240|0.00|1|0|0|0000000000|1||||||||||
50|05298258|4045160216|20020729|142555|4045160216||INCOMING|CL||P|120|0.00|1|0|0|0000000000|2||||||||||
50|05298258|4045160216|20020729|151445|4045160216||INCOMING|CL||P|240|0.00|1|0|0|0000000000|3||||||||||
50|05298258|4045160216|20020828|092024|0000000099||VOICE MAIL|CL||P|180|0.00|0|0|0|0000000000|43||||||||||
50|05298258|4045160216|20020828|092724|0000000099||VOICE MAIL|CL||P|420|0.00|0|0|0|0000000000|44||||||||||
50|05298258|4045160216|20020828|180714|6784858361||ATLANTA NE|GA||P|60|0.00|0|0|0|0000000000|45||||||||||
the first record in every line maps to a particular table in our database.
Any ideas will be appreciated.