From: SunRaySon Date: 2007-03-31T06:14:52+09:00 Subject: Re: text processing ------=_Part_44641_17955500.1175289289999 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Stephen, You could iterate on each line using the each method then use the string as an array as the fields are fixed length. File.open(filename) |f| f.each |line| field1 = line[0..2] field2 = line[3..4] ....... end end Kiran Kumar On 3/30/07, Stephen Smith <4fires@gmail.com> wrote: > > Hi all, > > So I have about a half million records in a non-standard, non-delimited > format. The fields are fixed widths, each record is separated by a new > line. > I need to get this data into csv format so I can import it into a mysql > database for analysis. > > I figure a script is the best way, but I'm stumped since the fields aren't > delimited. > > Any tips, suggestions, pointers or a script that does something similar > would be GREATLY appreciated. > > I am very new to Ruby, but I am impressed so far. > > And I know there's a way to do this, I just don't know how it's done. > > Best, > Steve (ruby noob) > ------=_Part_44641_17955500.1175289289999--