Export contacts in Entourage
If you've exported your contacts in Entourage to a tab delimited file, you can use the following script to convert it into a readable form without all the mess.
First thing to do is to change the line endings. Note, I'm using a Mac to do this, but any Linux environment should work fine.
Open up Terminal from Applications > Utilities and run this command. The ^M character can only be entered by holding control and hitting v followed by the letter m. You must not literally type ^M.
Also note, I've exported my contacts to the file your_contacts.txt.
$ perl -p -i.bak -e "s?^M?\n?g" your_contacts.txt
Now put the following code into a file, say convert_phone_contacts.php, in the same directory as your_contacts.txt.
$a_contacts = file("your_contacts.txt");
$x = 1;
foreach($a_contacts as $contact)
{
$a_contact = explode("\t",$contact);
if($x == 1)
{
$a_headings = $a_contact;
}
for($i=0;$i<=83;$i++)
{
if($a_contact[$i] != "")
{
echo("{$a_headings[$i]}={$a_contact[$i]} | ");
}
}
echo("\n");
unset($a_contact);
$x += 1;
}
?>
Run this php file from the command line with,
$ php convert_phone_contacts.php > new_contacts.txt
This will store the new contacts in new_contacts.txt.
Note, I'm using Entourage from Office 2008. There were 84 different fields. That's why the loop goes from 0 to 83. You may need to change that if yours is different.
[Click to add or edit comments])
Please prepend comments below including a date