Hi, I am modifying on script. I am using this script to import data form text-delimited file into PosgresSql database.
I have already setup a code for tab separation but facing problem in comma separation. In text-delimited file there is foulr field which are inter related. first "organization & City" and Second "State & Country". Where organization & City are separated with commas ", " and State & Country. But when the script will execute it will split the not only tab separated fields but also as and when he found comma separated field i.e.organization & City then it will split the Organization & city and stored it the respected field. Could anybody please help me in this> I have no such exposure to Ruby. I have here attached the data_importer.rb file for your reference also need help here pasted code. ============================================================ f.read.each do |l| if counter > 0 tokens = l.split(/\t/).collect{|ss| ss.delete("\"") } hn = tokens[0] pgn = tokens[1] sn = tokens[2] pio = tokens[3] dio = tokens[4] org = tokens[5] al1 = tokens[6] al2 = tokens[7] ci = tokens[8] st = tokens[9] pc = tokens[10] co = tokens[11] te = tokens[12] fax = tokens[13] ew = tokens[14] eo = tokens[15] wa = tokens[16] at1 = tokens[17] at2 = tokens[18] at3 = tokens[19] c1 = tokens[20] c2 = tokens[21] c3 = tokens[22] begin ====================================== Regards, Bhupendra Attachments: http://www.ruby-forum.com/attachment/3875/data_importer.rb -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---