--- /dev/null
+#!/usr/bin/env bash
+
+EVENT="$1"
+CACHE="$HOME/.cache/${0##*/}/events.csv"
+HEADER="participant,date_att,date_cancel"
+EXPR="
+1,/^$/ {
+ /^From:\|^Date:/ {
+ s/^[a-zA-Z]*: *\(.*\)$/\1/
+ p
+ }
+}
+"
+
+if [ -f "$CACHE" ]; then
+ event=$(tail -1 "$CACHE")
+else
+ mkdir -p $(dirname "$CACHE")
+ echo -n "" > "$CACHE"
+fi
+if [ -n "$EVENT" -a "$EVENT" != "$event" ]; then
+ event="$EVENT"
+ echo "$event" >> "$CACHE"
+fi
+if [ -z "$event" ]; then
+ echo "${0##*/}: E: No event file." 1>&2
+ exit 1
+fi
+
+#info=$(cat | sed -n -e "$EXPR" | tr '\n' '|')
+info=$(cat | grep '^From:\|^Date:' | tr '\n' ':')
+
+[[ "$info" =~ (From: )([^:]*) ]]
+participant="${BASH_REMATCH[2]}"
+[[ "$info" =~ (Date: )([^:]*) ]]
+date=$(date -I -d "${BASH_REMATCH[2]}")
+
+echo "${participant},${date}" | tee -a "$event"
+n_t=$(cat "$event" | grep -v "$HEADER"| cut -d, -f2 | grep -v '^$' | wc -l)
+n_c=$(cat "$event" | grep -v "$HEADER"| cut -d, -f3 | grep -v '^$' | wc -l)
+n_p=$(( $n_t - $n_c ))
+echo -ne "At $event:\n part: $n_p\n canc: $n_c\n" 1>&2