cleand and with-nth

This commit is contained in:
2025-06-05 20:05:58 +02:00
parent 6973fb9f04
commit aaf3c56565
4 changed files with 22 additions and 28 deletions

View File

@@ -48,7 +48,7 @@ function title(start, summary) {
depth = split(FILENAME, path, "/");
collection = depth > 1 ? path[depth-1] : "";
collection = collection in collection2label ? collection2label[collection] : collection;
return FAINT "~ " collection " " gensub(/^[^0-9]*([0-9]{4})([0-9]{2}).*$/, "\\1-\\2", "1", start) " " summary " ;" start OFF
return FAINT "~ " collection " " gensub(/^[^0-9]*([0-9]{4})([0-9]{2}).*$/, "\\1-\\2", "1", start) " " summary OFF
}
BEGIN {
@@ -69,7 +69,7 @@ BEGIN {
OFF = "\033[m";
}
BEGINFILE { inside = 0; rs = 0; dur = 0; summary = ""; start = "ERROR"; end = "ERROR" }
/^END:VEVENT/ { print start, dur ? start " " end : end, title(start, summary), fn(FILENAME, n, a); nextfile }
/^END:VEVENT/ { print "~", start, dur ? start " " end : end, title(start, summary), fn(FILENAME, n, a); nextfile }
/^DTSTART/ && inside { start = parse( dt) }
/^DTEND/ && inside { end = parse( dt) }
/^DURATION/ && inside { end = parse_duration( dt, dta, i, n, a, seps); dur = 1 }

View File

@@ -11,7 +11,7 @@ NR == FNR {
if (from[FNR] > to[FNR])
print "FNR", FNR, ":", from[FNR],"-",to[FNR], " ",$0;
for(i=from[FNR]; i<=to[FNR]; i++) {
week[i] = week[i] ? week[i] ";" $4 : $4
week[i] = week[i] " " $5
}
}
END { for (i in week) print i, week[i]; }
END { for (i in week) print i week[i]; }

View File

@@ -8,12 +8,13 @@ BEGIN {
CYAN = "\033[1;36m";
FAINT = "\033[2m";
OFF = "\033[m";
OFS = "|"
}
/^[0-7] 00:00 -- 00:00/ { dayline = dayline " " c(); next }
/^[0-7] 00:00 -- / { dayline = dayline " <-|" $4 " " c(); next }
/^[0-7] [0-9]{2}:[0-9]{2} -- 00:00/ { dayline = dayline " " $2 "|-> " c(); next }
/^[0-7] [0-9]{2}:[0-9]{2} -- [0-9]{2}:[0-9]{2}/ { dayline = dayline " " $2 " - " $4 " " c(); next }
/^[0-7]$/ && dayline { print dayline " ;" startofweek " +" $0 " days"; }
/^[0-7]$/ && dayline { print "+", startofweek " +" $0 " days", "", dayline; }
/^[0-7]$/ {
cmd = "date -d '" startofweek " +" $0 " days' +\"%a %e %b %Y\"";
cmd | getline dayline;