View Single Post
Posts: 259 | Thanked: 72 times | Joined on Dec 2007 @ Halifax, NS
#23
Ok time to pull out the big guns.

Code:
#!/usr/bin/perl

my $fn=100;
my $lastfn=0;

while (<>) {
  if ($_ =~ (/^\n/)) { $fn+=1; print JOUTFILE "\n"; next;}
  if ($fn != $lastfn) {
    if (<JOUTFILE>) {    print JOUTFILE "quit\n"; }
    close(JOUTFILE);
    open(JOUTFILE, ">new$fn.vcf");
    $lastfn=$fn;
    print JOUTFILE "ADD VCARD $_";
  } else {
    if ($_ =~ (/^END:VCARD/)) { print JOUTFILE $_ . "quit\n"; next;}
    print JOUTFILE $_;
  }
}
Take your original .vcf (you don't need the manual changes I got you to do before) and pass it to this script. I suggest you make another directory for this, because you're going to have a lot of files.

Code:
mkdir vcf
cd vcf
perl ../vconvert.pl ../yourfile.vcf
You should have one .vcf file per contact with the gpesyncd changes in there already. Now, it's importing time! Make sure you do this as user, because it's user's contacts.

Code:
for i in $(ls new*.vcf); do gpesyncd - ; done
Again, keep me posted.