Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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
Last:
First: Fred Flintstone
Last:

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
add comment

2 Answers

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

share|improve this answer
1  
And another AppleScript + ruby starting point: mkdynamic.wordpress.com/2007/11/10/… –  user588 Dec 18 '10 at 2:09
add comment

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
add comment

Your Answer

 
discard

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.