Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 3 down vote accepted

If you are comfortable with AppleScript, you should be able to get it done using this web page as a starting point:

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 ';'.

share|improve this answer
And another AppleScript + ruby starting point:… – user588 Dec 18 '10 at 2:09

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.