URI: 
       adapt ics generation from CSV + header line - ics2txt - convert icalendar .ics file to plain text
  HTML git clone git://bitreich.org/ics2txt git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/ics2txt
   DIR Log
   DIR Files
   DIR Refs
   DIR Tags
   DIR README
       ---
   DIR commit c6606df0960a765824c000aeb54e21691bcc94bb
   DIR parent cc9fc8e92e72543aca8d35b19f0c3c614df186b4
  HTML Author: Josuah Demangeon <me@josuah.net>
       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(-)
       ---
   DIR 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 {