From: Morton Goldberg Date: 2007-07-27T12:44:31+09:00 Subject: Re: How to delete array element and add to previous element On Jul 26, 2007, at 9:59 PM, Al Cholic wrote: > I reposting my last response since there is no edit on this forum. > > Sorry about the syntax. I was just trying to show the array, it > was not > intended to be ruby code. What Im trying to do is read a text file > and > then make sense of the data in that text file and store that info in a > database. I have managed to sort out into the arrays but need to get > the POS2c etc elements into the same array (im guessing thats the best > way to do it). > > For example here is code that im shuffling: > > 49 7 RP13,RP15,RP17,RP19,RP24, 12X2 33XD Wireless, > Independent, 5% > RP32,RP33 > 50 4 RP27,RP28,RP30,RP31 10XC4 3X567 Network, Isolated, 5% > 51 31 R1,R2,R8,R30,R32,R33,R35, 0603,R10K,1% 0603 3%,1/12W > R37,R39,R41,R42,R43,R49, > R50,R51,R52,R58,R68,R69, > R71,R72,R74,R85,R95,R117, > 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