It’s easy to use the “cut” command to convert your Thunderbird contacts into a format that GMail is happy to import.

Start out in Thunderbird, click Tools, Address Book. Once the Address Book pops up click Tools, Export. A save dialog should popup asking you to for a filename and folder. Look down by the save button, change the format dropdown from LDIF to CSV, name the file myExport.csv and click Save. The default of the home dir should be fine.

All of your T-Bird contacts are now in the CSV file, but GMail won’t appreciate the extra columns and lack of headers. We can fix that easily from the command line. Open a shell and change to the directory where you saved your CSV. Run the following command:

echo First Name,Last Name,Email Address > toImport.csv ; cat myExport.csv |cut -d”,” -f1,2,5 >>toImport.csv

Now head over to your gmail account and import the csv. The Import link is on the “Contacts” page near the top right.

GMail should report success once it’s done processing the file and tell you how many contacts it imported.

Related posts:

  1. read a file with bash
  2. Ubuntu Network Interface Issues.
  3. Shuffle a Playlist onto CD-Rs
  4. using sed to parse a file.
  5. BASH: Split a string without ‘cut’ or ‘awk’