Nov-24-2020, 02:02 PM
I have a file that is exported from an upstream system and data is not the same in each row.
But the main attributes in the file are below. Not all the rows might have all the attributes.
unitnumber
idnumber
mail
givenname
manager
department
city
title
mobile
Contents in the file are as below and can only have the above attributes.
i/p:
I need to create a csv file from this that has the data in the below format
required o/p:
1st line with header that can be static followed by the data from the above file.
Any help is appreciated
But the main attributes in the file are below. Not all the rows might have all the attributes.
unitnumber
idnumber
givenname
manager
department
city
title
mobile
Contents in the file are as below and can only have the above attributes.
i/p:
Quote:('uid=test.test51,ou=People,o=ic.com,o=xerox', {'city': ['Irving'], 'title': ['Application Developer'], 'mobile': ['2054444444'], 'manager': ['test.test100'], 'idnumber': ['44451'], 'department': ['National Claims'], 'mail': ['[email protected]'], 'givenname': ['Test1'], 'unitnumber': ['551']})
('uid=pinuser,ou=People,o=ic.com,o=xerox', {'givenname': ['Pin']})
('uid=jim.gober,ou=People,o=ic.com,o=xerox', {'city': ['Birmingham'], 'title': ['CEO'], 'manager': ['jim.gober'], 'idnumber': ['137741'], 'department': ['Executive'], 'givenname': ['James'], 'unitnumber': ['887']})
('uid=ServiceAdmin,ou=People,o=ic.com,o=xerox', {})
('uid=joann.kerr,ou=People,o=ic.com,o=xerox', {'city': ['Alpharetta'], 'title': ['Senior Software Architect'], 'manager': ['Cynthia Berger'], 'idnumber': ['0003677'], 'department': ['Information Technology'], 'givenname': ['Joann'], 'unitnumber': ['SHD']})
I need to create a csv file from this that has the data in the below format
required o/p:
1st line with header that can be static followed by the data from the above file.
Quote:unitnumber,idnumber,mail,givenname,manager,department,city,title,mobile
551,44451,[email protected],Test1,test.test100,National Claims,Irving,Application Developer,2054444444
,,,Pin,,,,,
887,137741,,James,jim.gober,Executive,Birmingham,CEO,
,,,,,,,,
SHD,0003677,,Joann,Cynthia Berger,Information Technology,Alpharetta,Senior Software Architect,
Any help is appreciated