I have a file that looks something like this:
|29923C|SomeGuy,NameHere1 |00039252|042311|Some Address Info Here | |47422K|SomeGuy,NameHere2 |00039252|042311|Some Address Info Here | |98753D|SomeGuy,NameHere3 |00039252|042311|Some Address Info Here | |29923C|SomeGuy,NameHere4 |00039252|042311|Some Address Info Here | |47422K|SomeGuy,NameHere5 |00039252|042311|Some Address Info Here |
I need to split a file into several files based on the first 6 characters starting at position 2.
File 1 with the name 29923c.asc:
|29923C|SomeGuy,NameHere1 |00039252|042311|Some Address Info Here | |29923C|SomeGuy,NameHere4 |00039252|042311|Some Address Info Here |
File 2 named 47422K.asc:
|47422K|SomeGuy,NameHere5 |00039252|042311|Some Address Info Here | |47422K|SomeGuy,NameHere2 |00039252|042311|Some Address Info Here |
File 3 with the name 9875D.asc:
|98753D|SomeGuy,NameHere3 |00039252|042311|Some Address Info Here |
I do not know what will be in the file before the program receives it, only the format. 6 digits will vary depending on the client. I do not know what they will be.
The only thing I know is the format.
Can someone give me a suggestion on how to dynamically receive / maintain this information so that I can parse it into separate files?
Erocm source share