If you’ve recently purchased a Mac, the process of converting windows files to the OSX address book is a poor process, particuarly if the Windows machine is no longer running.

Don’t sweat it.  If you can get the files, located in various folders to the Mac, run this script on the parent folder holding the data files and it will find the various Windows contact files and simply dump out a list of name and emails.  Not perfect but could be tweaked easily to grab other data as your need sees fit.

 

IFS=$'\n';for d in `find . -iname "*Contact"`;do cat $d|grep NameCollection| 
sed -e "s/.*//;s/.*//";cat $d|grep NameCollection| 
sed -e "s/.*//;s/.*//" ;done | 
awk '!(NR%2){print p"t"$0}{p=$0}' > mycontacts.txt

 

That will save a file your contacts to a file called mycontacts.txt which can then be imported into the mac address book.

 

Two caveats…

You don’t capture in the first name, last name format as expected by mac address book though you could probably hack this to print it that way if so inclined.  I simply map the names to the first name field.

 

The second caveat is some lines print out a bunch of formatting crap from the xml that they’re stored in.  You probably want to open your flie in any text editor and clean it manually dumping the extra data on those lines… you’ll know right away what I mean.  Finding the name/email in those lines is tedious…but hey, if you got 200 contacts and this misses 10% of them, that 20 to clean by hand vs all 200.  Lot’s of those, you’ll see are name missing errors, others have various text…if you’ve got enough, it may make sense to parse them manually and separate the good from the bad for more automatic processing.  In my case, there was only 20 of 200 to do, hence this was enough of a process for me.

 

Hope it helps.

Enjoy..

D.

Verified by MonsterInsights