import string, sys

class Contact:

	name=""
	email=""
	notes=""
	s1_desc=""
	s1_email=""
	s1_im=""
	s1_phone=""
	s1_mobile=""
	s1_pager=""
	s1_fax=""
	s1_company=""
	s1_title=""
	s1_other=""
	s1_address=""
	s2_desc=""
	s2_email1=""
	s2_im=""
	s2_phone=""
	s2_mobile=""
	s2_pager=""
	s2_fax=""
	s2_company=""
	s2_title=""
	s2_other=""
	s2_address=""


	def __init__(self):
		self.setAllToBlank()

	def __init__(self, contactAry):

		self.setAllToBlank()

		for i in range(0, len(contactAry)):
			contactAry[i]=string.replace(contactAry[i], "\"", "")
			contactAry[i]=string.capwords(contactAry[i])

		try:
			self.name=contactAry[0]
			self.email=contactAry[1]
			self.notes=contactAry[2]
			self.s1_desc=contactAry[3]
			self.s1_email=contactAry[4]
			self.s1_im=contactAry[5]
			self.s1_phone=contactAry[6]
			self.s1_mobile=contactAry[7]
			self.s1_pager=contactAry[8]
			self.s1_fax=contactAry[9]
			self.s1_company=contactAry[10]
			self.s1_title=contactAry[11]
			self.s1_other=contactAry[12]
			self.s1_address=contactAry[13]
			self.s2_desc=contactAry[14]
			self.s2_email1=contactAry[15]
			self.s2_im=contactAry[16]
			self.s2_phone=contactAry[17]
			self.s2_mobile=contactAry[18]
			self.s2_pager=contactAry[19]
			self.s2_fax=contactAry[20]
			self.s2_company=contactAry[21]
			self.s2_title=contactAry[22]
			self.s2_other=contactAry[23]
			self.s2_address=contactAry[24]
		except:
			print "Missing fields for  " + self.name


	def setAllToBlank(self):
		self.name=""
		self.email=""
		self.notes=""
		self.s1_desc=""
		self.s1_email=""
		self.s1_im=""
		self.s1_phone=""
		self.s1_mobile=""
		self.s1_pager=""
		self.s1_fax=""
		self.s1_company=""
		self.s1_title=""
		self.s1_other=""
		self.s1_address=""
		self.s2_desc=""
		self.s2_email1=""
		self.s2_im=""
		self.s2_phone=""
		self.s2_mobile=""
		self.s2_pager=""
		self.s2_fax=""
		self.s2_company=""
		self.s2_title=""
		self.s2_other=""
		self.s2_address=""



	def printContact(self):
		line="\"" + self.name + "\","
		line=line  + "\"" + self.email + "\"," 
		line=line  + "\"" + self.notes + "\"," 
		line=line  + "\"" + self.s1_desc + "\"," 
		line=line  + "\"" + self.s1_email + "\"," 
		line=line  + "\"" + self.s1_im + "\"," 
		line=line  + "\"" + self.s1_phone + "\"," 
		line=line  + "\"" + self.s1_mobile + "\"," 
		line=line  + "\"" + self.s1_pager + "\"," 
		line=line  + "\"" + self.s1_fax + "\"," 
		line=line  + "\"" + self.s1_company + "\"," 
		line=line  + "\"" + self.s1_title + "\"," 
		line=line  + "\"" + self.s1_other + "\"," 
		line=line  + "\"" + self.s1_address + "\"," 
		line=line  + "\"" + self.s2_desc + "\"," 
		line=line  + "\"" + self.s2_email1 + "\"," 
		line=line  + "\"" + self.s2_im + "\"," 
		line=line  + "\"" + self.s2_phone + "\"," 
		line=line  + "\"" + self.s2_mobile + "\"," 
		line=line  + "\"" + self.s2_pager + "\"," 
		line=line  + "\"" + self.s2_fax + "\"," 
		line=line  + "\"" + self.s2_company + "\"," 
		line=line  + "\"" + self.s2_title + "\"," 
		line=line  + "\"" + self.s2_other + "\"," 
		line=line  + "\"" + self.s2_address + "\"" 

		print line



cFile=open(sys.argv[1])

contacts = {}
for line in cFile:
	c=Contact(line.split(","))

	if c.name == "":
		continue

	if contacts.get(c.name, None) == None:
		contacts[c.name] = c
	else:
		
		print "found dup = " + c.name

cFile.close()
	





