#!/bin/bash

# Argument list should be the log files from a 4KTasksRep run.

fc=4000
al="$#"
[[ ${al} == ${fc} ]] && echo "Found ${fc} files, as expected." || echo "Wrong number of log files ${al}, expected ${fc}."

sum=4007998000
dbsum=$(awk 'FNR == 2{c = c + $1}END{printf("%d\n", c)}' "$@")
[[ ${sum} == ${dbsum} ]] && echo "Sum is ${sum}, as expected." || echo "Wrong sum ${dbsum}, expected ${sum}."

echo "Should be ~13.00"
awk 'FNR == 3{s = $1}FNR == 4 {c = c + $1 - s}END{printf("%.2f\n", c/4000.)}' "$@"

echo -e "Now run:\n awk -F'\\\\t' '{print \$5}' <StatusFile>  | sort | uniq -c "
