Salvage Evolution Addressbook from prior installation

I’ve been in the process of migrating from Ubuntu to OpenSuSE 11.1 this past week. While I really liked Ubuntu, they put out a 64-bit kernel update which was any direction but “up”. Problems were spread far and wide, yet they didn’t send out another update backing this update out. Given the company putting out Ubuntu wants to become the desktop of choice when corporations dump their legacy Windows desktops, this was not a smooth move. It alienated a lot of users at a time when most of the off-shore consulting companies have already begun abandoning Microsoft products. The first cut has been to get rid of Outlook and Exchange, replacing them with Gmail. The second step has been to remove MS Office and replace it with OpenOffice. Pretty much every corporation which will still be here in 3 years has moved to the Open Document Standard. Even IBM has now released a free Lotus Symphony word processor which runs on a lot of platforms and creates the Open Document format as its default output. (Not only that, but it can read Lotus WordPro and other IBM document file formats. There may very well be some quirks when reading complex documents, but so far this is your only “free” option.)

I dutifully did an image backup and even copied my home directory off to a USB drive.  I nuked the Ubuntu partitions and performed the process of installing SuSE.  Then I performed the process of installing all of that software you don't have the option of choosing when installing from DVD.  When I started configuring email, I learned of a real bug-a-boo with Evolution.  You cannot simply copy the addressbook.db file from your backup copy to the correct place in the newly created folder.  That trick works with the email tree, but it is a prescription for heartache when you try it with the addressbook.db file.

Needless to say, I've spent the better part of the last few days searching the Web and trying various things.  The bottom line is that you are nearly pooched if you forget to use the “export” function in Evolution before moving to a new OS or even re-installing Evolution.  Then I found this Web site:  [mraswan hub](

In case the site moves, I’m going to post the code here. It requires you have the BerkeleyDB package for perl installed, but you probably already do, if not, I haven’t found a distro that didn’t include it. You want to direct the output to a listing file because it is pretty ugly. A little time spent with a text editor and your new Evolution installation will allow you to salvage most of your data.

#!/usr/bin/perl -w
use strict;
use 5.008;
use BerkeleyDB;

package addressbook;
sub new {
# Create new object
my $class = shift;
my $self = {};
bless $self, $class;

sub getBook {
	# initialize variables
	my $self = shift;

sub printBook {
	my $self = shift;
	use vars qw( %h $k $v ) ;
	my $filename = "/media/USB_250/addressbook/local/1/addressbook.db" ;
	tie %h, "BerkeleyDB::Hash",
				-Filename => $filename,
				-Flags    => BerkeleyDB::DB_RDONLY
		or die "Cannot open file $filename: $! $BerkeleyDB::Error

" ;

	# print the contents of the file
	while (($k, $v) = each %h) {
		print "

$k -> $v";

	untie %h ;


package main;
my $addressbook = new addressbook();
print "