How do I Parse a non-delimited flat-file

51 views Asked by At

I have some flat files where each line is about 300 characters. The data has no delimiters of any kind and I want to parse the file to introduce some sort of delimiter between fields. There are actually about 50 different fields, of varying lengths contained in each line. All the lines line up nicely. I am trying to figure a way that I can mark fields in one row and have that extend to all the rows. There are about 2.5-3 million rows per file. I am not a programmer so I really need something that already works. I have been playing with splitting the files into parts and using Excel, but that is taxing the computer system I have, Windows, 8Gb Ram.

I have found a VBA program that loads the files into multiple sheets of Excel. I then have used Excel to parse the data, but it severely taxes the system. Below is an example of a few records. The data fields vary from 1 to 10 characters in length. Since the file is 3 million records I hope to somehow introduce a delimiter in the top row and have that introduced into all the rest of the records. –

Here is the data, the records are longer but you get the idea. The spaces do not necessarily designate a field break

11MD122MD4MD MD122999999 MD 4 TX WI 3101 M1088 412110 1D8
11AK122AK4AK AK122999999 AK 4 TX VT 5101 M1066 432311 1W7

Some fields might be 5 characters, but only contain 4 visible characters, the last character would be a space. This then allows all records to be the same total length. In the example data I showed, the first 12 characters represent 7 fields. I need to parse this. The remaining record is more of the same. The Excel VBA file only pulls in the records. Each record is contained in a single Excel cell and then needs to be parsed.

Drummo2a 4 mins ago Edit

Thanks

0

There are 0 answers