Following a MobileMe import of a Windows XP AddressBook legacy, there are hundreds of entries in the Mac Address Book like this:

First: Harry Potter
First: Fred Flintstone

It appears that what happened is that both the First and Last names in the Windows XP Address Book migrated to the Firstname field in Mac Address Book.

Is there a way to bulk-edit these? Going through the GUI means click on first name, highlight tail, cut, click on last, paste, next. It would be nice to do that in a text editor or with a wee perl script.

Can the Address Book be exported as structured text and subsequently replaced by modified structured text?


If you are comfortable with AppleScript, you should be able to get it done using this web page as a starting point: http://hints.macworld.com/article.php?story=20070813135408868

Otherwise, you can export one or more cards in the vCard format, open that up in a file editor and it looks like a properly separated name field looks like this: "N:Smith;Joe;;;" so if yours look like "N:Joe Smith;;;;" and you are comfortable with regular expressions you should be able to work out a search and replace that would look for 'N:(word1) (word2);' and replace it with 'N:(word2);(word1)'. I think that would give you the right number of ';'.


You can export from inside AddressBook to vCard format which is ASCII, or use the contacts program to dump your AddressBook to plain text. Find the problematic entries, reformat them using your favorite scripting/programming language, or use Google Refine if you are not a programmer, create a new CSV file, and then re-import. Check it works, then delete the originals.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .