Skip to content

Instantly share code, notes, and snippets.

@ravnx
Created May 7, 2020 04:10
Show Gist options
  • Select an option

  • Save ravnx/80dda853a4b22b1705c79380433457b1 to your computer and use it in GitHub Desktop.

Select an option

Save ravnx/80dda853a4b22b1705c79380433457b1 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl -w
# This perl script will do a quick and dirty parse from
# outlook vcal to evolution ical format
# Last Update:Thu Feb 05 11:49:59 CST 2004
## New note: Putting this here for archival purposes. Not even sure if outlook uses vcs anymore.
use strict;
my $file = $ARGV[0] or die "No filename specified";
die if (!-e $file);
my $newfile = $file;
$newfile =~ s/\..*$/\.ics/;
open(VCSFILE,$file)
or die "Error opening '$file': $!\n";
my @vcs = <VCSFILE>;
close(VCSFILE);
open(ICSFILE,">".$newfile)
or die "Error opening '$file': $!\n";
foreach(@vcs) {
s/^(\w+);[\w\=\-]+:/$1:/; s/^(\w+:)\s/$1/; s/^End/END/;
s/=0D/\\n/g; s/=0A//g; s/\015\012/\n/g; s/,//g;
print ICSFILE if (!/^ORGAN|PRODI/);
}
close(ICSFILE);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment