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