From: Al Cholic Date: 2007-07-27T15:12:08+09:00 Subject: Re: How to delete array element and add to previous element Morton Goldberg wrote: > On Jul 26, 2007, at 9:59 PM, Al Cholic wrote: > >> >> R129,R130,R155,R156,R158, >> R160 > > Now I understand. That's a rather nasty data file. How I would go > about reformatting to something more rational would depend on what > the field separators really are. I mean is > > 49 7 RP13,RP15,RP17,RP19,RP24, 12X2 33XD Wireless, Independent, 5% > > really > > 49\t7\tRP13,RP15,RP17,RP19,RP24,\t12X2\t33XD\tWireless, Independent, 5% > > which I construe as 6 tab-delimited fields, or am I misreading it? > Also, can any field other than the second one spill over onto > following lines? And is the white space after the commas in what I > think is last field significant? That is, does 'Wireless, > Independent, 5%' need to be handled differently than > 'RP13,RP15,RP17,RP19,RP24,'? > > Regards, Morton Only the third column with the R37,R39,R41,R42,R43,R49 can spill over to the next line. Yes, the elements are separated by tabs like you said. I have managed to get the lines into an array by just using inputed_text.strip.split("\n") So now I have an array that contains each line as its elements. But the problem is that I need to get the spilled over lines into a subarray of the right line. I think this is the easiest way to organize the data. After i get the spilled over elements to the right location i can go a head and put the data into a database because I know which element in the array represents what. I hope this helped in clarifying the issue. Thanks for you help so far. -- Posted via http://www.ruby-forum.com/.