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
irssi_format.kv 8 awk -v mindex=$1 'BEGIN{months="JanFebMarAprMayJunJulAugSepOctNovDec"}
irssi_format.kv 9 /Day changed/ {Month=int((index(months,$5)+2)/3); Day=$6; Year=$7;}
irssi_format.kv 10
irssi_format.kv 11 /Log opened/ {Month=int((index(months,$5)+2)/3); Day=$6; Year=$8;}
irssi_format.kv 12 ! /(-->)|(<--)|(---)/ {count++; sep=";";
irssi_format.kv 13 w= Year " " Month " " Day " " substr($1, 1, 2) " " substr($1, 4, 5) " 00";
irssi_format.kv 14 if ($2 == "*") {
irssi_format.kv 15 pp= $2 sep $3 " "; $3=""; n=4;
irssi2tmsr.kv 16 } else {
irssi_format.kv 17 pp=substr($2, 1, length($2)-1) sep; n=3;};
irssi_format.kv 18 $1=""; $2="";
irssi2tmsr.kv 19 print count+mindex-1 sep mktime(w) sep pp substr($0,n);
irssi2tmsr.kv 20 }'
irssi_format.kv 21