Решение "в лоб".
Код:
#!/usr/bin/env bash
x=`awk -F'[. ]' '$9 == "E" {
cmd = "date -d \"" $6 " " $7 "\" +%s"
cmd | getline ts
close(cmd)
printf ":%d", ts
next
} NR > 1 {print ""}{p=$9}' msg.txt | awk '{
system("echo \"("$NF"-"$2") / 60\" | bc 2>/dev/null")
}' FS=\:`
echo "Number of events: `sed -n '$=' <<< $x` Events durations:" $x