Here is a little script I wrote, but I won't sing it note for note (even if it is intended for Opera). Opera exports its contacts to an .adr file. To import it to other mail clients I had to convert it to a CSV list.

The script extracts all fields that are marked as contacts and ignores folders and Trash.

Here is the code:
#!/usr/bin/perl # # use strict; use warnings; use Getopt::Long; use Pod::Usage; my $input = ''; my $output = 'addresses.csv'; my $delimiter = "##"; GetOptions( 'i|input=s' => \$input, 'o|output=s' => \$output, 'd|delimiter=s' => \$delimiter ); pod2usage( -message => "Missing input file name :\n", -verbose => 1 ) if ( $input eq '' ); my ( @table, @cols ); my %cols; open( my $in, "<", $input ) or die "Can not open $input ", $!, " \n"; local $/; my $content = <$in>; close $in; open( my $out, '>', $output ) or die "Can not open $output", $!, "\n"; if ( $content =~ /\t/ ) { $content =~ s/\t//g; } my @chunks = split '#', $content; for my $line (@chunks) { my %data; if ( $line =~ /CONTACT/ ) { $line =~ s/CONTACT//; if ( $line =~ /\n/ ) { my @line = split /\n/, $line; for my $line (@line) { chomp $line; if ( $line =~ /(.+?)=.+/ ) { unless ( $cols{$1} and $cols{$1} == 1 ) { $cols{ ucfirst lc $1 } = 1; push @cols, ucfirst lc $1; } my @fields = split '=', $line; if ( $fields[1] ) { $data{ ucfirst lc $fields[0] } = $fields[1]; } } } } } push @table, \%data if (%data); } print $out join $delimiter, @cols, "\n"; for my $row (@table) { my @rows; for (@cols) { if ( $$row{$_} ) { push @rows, $$row{$_}; } } print $out join $delimiter, @rows, "\n"; } close $out; __END__ =head1 NAME operaadr2csv.pl - Converts Opera .adr files to csv file =head1 SYNOPSIS operaadr2csv.pl -i [inputfile] [options] Options: -i | input -d | -delimiter -o | -output =head1 OPTIONS =over 8 =item -i Sets the name of the input file. This option is mandatory. =item -d Sets a delimiter. The default delimiter is ## =item -o Sets a name for the outputfile. The default name for the output file i +s addresses.csv =back =head1 DESCRIPTION This program will convert contacts from opera browser .adr fileformat +to a csv list. The delimiter for the creation of the csv file can be +changed. =cut

In reply to Convert Opera Contacts in .adr format to csv by walto

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.