
# SEED, SOFTWARE, AND SEARCH PARAMETERS
n_min=1
n_max=4
w_min=3
w_max=16
l_max=64
r=1

AWK='gawk'
SED='gsed'
CAT='cat'
GREP='grep'
SORT='sort'
UNIQ='uniq'

# header
echo -n "n \ w"
for ((w=${w_min}; w<=${w_max}; w++))
do
    echo -n " & ${w} "
done
echo " \\\\"

for ((n=${n_min}; n<=${n_max}; n++))
do
    echo -n " ${n} "
    for ((w=${w_min}; w<=${w_max}; w++))
    do
	s=$((2*$w));
	l_v_max=0;
	v_max=0;
        for ((l=${s}; l<=${l_max}; l++))
        do
	    run=`find ./experiments -name "_n${n}_w${w}_s${s}_l${l}.ied" -exec wc -l \{\} \;`

	    [[ "${run}" =~ ([0-9]+).* ]]
	    if [ "${BASH_REMATCH[1]}" -ge "$v_max" ]; then
		v_max="${BASH_REMATCH[1]}"
		l_v_max=${l}
	    fi
	done
	echo -n " & $v_max ($l_v_max)"
    done
    echo " \\\\"
done
