How to manage Tab & Comma separated filds form single text f

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.

Please find more below more hints on what the code is :