Introduction
Introduction Statistics Contact Development Disclaimer Help
adapt ics generation from CSV + header line - ics2txt - convert icalendar .ics …
git clone git://bitreich.org/ics2txt git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws…
Log
Files
Refs
Tags
README
---
commit c6606df0960a765824c000aeb54e21691bcc94bb
parent cc9fc8e92e72543aca8d35b19f0c3c614df186b4
Author: Josuah Demangeon <[email protected]>
Date: Wed, 24 Jun 2020 23:26:23 +0200
adapt ics generation from CSV + header line
Diffstat:
M tsv2ics | 33 +++++++++++++++++++++--------…
1 file changed, 23 insertions(+), 10 deletions(-)
---
diff --git a/tsv2ics b/tsv2ics
@@ -60,29 +60,42 @@ function print_fold(prefix, s, n)
}
BEGIN {
+ FS = "\t"
+
print "BEGIN:VCALENDAR"
print "VERSION:2.0"
print "CALSCALE:GREGORIAN"
print "METHOD:PUBLISH"
}
+NR == 1 {
+ for (i = 1; i <= NF; i++)
+ name[i] = $i
+ next
+}
+
{
- split($0, a, "\t")
- gmtime(a[1] + offset, beg)
- gmtime(a[2] + offset, end)
- cat = a[3]; loc = a[4]; sum = a[5]; des = a[6]
+ for (i = 1; i <= NF; i++)
+ ev[name[i]] = $i
print ""
print "BEGIN:VEVENT"
+
+ gmtime(ev["beg"] + offset, ev)
printf "DTSTART:%04d%02d%02dT%02d%02d00Z\n",
- beg["year"], beg["mon"], beg["mday"], beg["hour"], beg["min"]
+ ev["year"], ev["mon"], ev["mday"], ev["hour"], ev["min"]
+
+ gmtime(ev["end"] + offset, ev)
printf "DTEND:%04d%02d%02dT%02d%02d00Z\n",
- end["year"], end["mon"], end["mday"], end["hour"], end["min"]
- print "SUMMARY:" sum
- print "DESCRIPTION:" des
- print "CATEGORIES:" cat
- print "LOCATION:" loc
+ ev["year"], ev["mon"], ev["mday"], ev["hour"], ev["min"]
+
+ print "SUMMARY:" ev["sum"]
+ print "DESCRIPTION:" ev["des"]
+ print "CATEGORIES:" ev["cat"]
+ print "LOCATION:" ev["loc"]
print "END:VEVENT"
+
+ delete ev
}
END {
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.