aboutsummaryrefslogtreecommitdiff
path: root/rem2ics
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-07-11 16:34:17 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-07-11 16:34:17 -0300
commit2e23f385dc9610f92d8ac57d5b584cbb92eedc4d (patch)
tree7b9ec796f6b6bf5b9393476db8085a43ecaa0465 /rem2ics
parenteb92c276862d8d11f1e6533acd6a23f5235de56b (diff)
downloadscripts-2e23f385dc9610f92d8ac57d5b584cbb92eedc4d.tar.gz
scripts-2e23f385dc9610f92d8ac57d5b584cbb92eedc4d.tar.bz2
Adding rem2ics
Diffstat (limited to 'rem2ics')
-rwxr-xr-xrem2ics31
1 files changed, 31 insertions, 0 deletions
diff --git a/rem2ics b/rem2ics
new file mode 100755
index 0000000..f4c7c05
--- /dev/null
+++ b/rem2ics
@@ -0,0 +1,31 @@
+#!/usr/bin/awk -f
+# rem2ics by Anthony J. Chivetta <achivetta@gmail.com>
+# from http://www.roaringpenguin.com/wiki/index.php/Rem2ics
+# version 0.1 - 2006-06-09
+# version 0.2 - 2010-10-27 (one-line patch by Shane Kerr <shane@time-travellers.org>)
+# Converts output of remind -s to iCalendar
+# usage: remind -s | rem2ics
+#
+# THE FOLLOWING CODE IS RELEASED INTO THE PUBLIC DOMAIN
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
+BEGIN {
+print "BEGIN:VCALENDAR"
+print "VERSION:2.0"
+}
+{
+gsub("/","",$1)
+print "BEGIN:VEVENT"
+if ($5 != "*"){
+printf("DTSTART:%dT%02d%02d00\n",$1,$5/60,$5%60)
+printf("DTEND:%dT%02d%02d00\n",$1,($5+$4)/60,($5+$4)%60)
+print "SUMMARY:" substr($0,match($0,$7))
+} else {
+printf("DTSTART:%d\n",$1)
+print "SUMMARY:" substr($0,match($0,$6))
+}
+print "END:VEVENT"
+}
+END {print "END:VCALENDAR"}