raw
irssi2tmsr.kv           1 #!/bin/bash
irssi2tmsr.kv 2
irssi2tmsr.kv 3 if [ "$#" -ne 1 ]; then
irssi2tmsr.kv 4 echo "Usage: $0 startIndex"
irssi2tmsr.kv 5 exit 1
irssi2tmsr.kv 6 fi
irssi2tmsr.kv 7
irssi2tmsr.kv 8 awk -v mindex=$1 '/Day changed/ {Month=$5; Day=$6; Year=$7;}
irssi2tmsr.kv 9 /Log opened/ {Month=$5; Day=$6; Year=$10;}
irssi2tmsr.kv 10 ! /-|<--|>/ {count++; sep=";";
irssi2tmsr.kv 11 w= Year " " Month " " Day " " $1 " " $2 " 00";
irssi2tmsr.kv 12 if ($3 == "*") {
irssi2tmsr.kv 13 pp=$3 sep $4 " "; $4=""; n=5;
irssi2tmsr.kv 14 } else {
irssi2tmsr.kv 15 pp=$3 sep; n=4;};
irssi2tmsr.kv 16 $1=""; $2=""; $3="";
irssi2tmsr.kv 17 print count+mindex-1 sep mktime(w) sep pp substr($0,n);
irssi2tmsr.kv 18 }'