#!/bin/bash


for db in mysql griddb; do
	INGEST=""
	EXTRACT=""
	for x in 1 2 3; do
		INGEST=$INGEST,$(grep elapsed ${1}-results-${db}-${x}.log | grep ingest | awk '{ sum += $7; n++ } END { if (n > 0) print sum / n; }')
		EXTRACT=$EXTRACT,$(grep elapsed ${1}-results-${db}-${x}.log | grep extract | awk '{ sum += $7; n++ } END { if (n > 0) print sum / n; }')
	done
	echo ingest,$db$INGEST
	echo extract,$db$EXTRACT
done
