Need Some Help Please!!

I"m given a file with a name in the format of last name, first name middle name. I need to output the data in the format of first name middle name last name. Some names don't have a middle name. I've gotten to display in the correct order but on each line the names are there twice. Is there anyway to get the names to display once?