Re: Parsing problem
- Posted by cklester <cklester at yahoo.com> Aug 16, 2005
- 624 views
Patrick Barnes wrote: > > I have some finance data that my bank insists on lumping all together > into one field. A sample of the data is below: > > Visa Purchase 26DECThe Carss Park Super Carss Par > Non Stg/Bsa Atm Wdl Fee > Internet Deposit 05JAN23:11itamoney > Visa Purchase 03JANWorld Vision Of Aust Burwood E > Adi Limited28686 > ... > Each line is a single field in the incoming .csv file. That's horrible. You should sue them. :D > Any suggestions on how to parse it? It looks like the first field is standard width (though you said that varies), I've had to write code to parse inconsistent files before. It's not that difficult as long as you can get a handle on the exceptions. I'd start by splitting the long space between the 1st and 2nd fields. Then I'd search for the times and dates (use the colon) and split that up. Depending on how many lines you have, you might want to just do it manually. Ouch. -=ck "Programming in a state of EUPHORIA." http://www.cklester.com/euphoria/