#!/bin/bash
# tml produces a timeline plot of a flowfile using the timestamps and the findex

if [ -f "$1" ]; then

  awk -F"\t" 'BEGIN { OFS="\t";}
       { i = strtonum($3);
	 a=sprintf("%d_0x%08x_%s_%d_%s_%d_%d_%s_%s_%d_%d_%d_%d_%s_%s",$2,i,$8,$10,$11,$13,$14,$16,$17,$18,$19,$20,$21,$126,$127);
         if( and(i,0x1) ) print $4,$2".5",$6,0,a > FILENAME"_b.txt";
         else print $4,$2,$6,0,a > FILENAME"_a.txt";

  }' $1

./tmlc $1 | gnuplot -p

else
    echo 'usage: ./tml flowfile'
fi
