#!/bin/bash 
for (( l=16; l<=64; l+=8))
do
    for (( w=2; w<=9; w++)) 
    do
	# single seed here
	cat main.weight.full.l$l.txt  | grep -v "," | grep -E "(-*#){$w}[^,#-]" | tr "." "0" > /tmp/_f_.txt
	for (( p=0; p<$l; p++ ))
	do
	    printf "l:%2d\tw:%1d\tp:%2d/%2d\t" $l $w $p $l;
	    cat /tmp/_f_.txt | sort -r -n -k $((2+00+$p))  | head -n 1 | sed 's/[^-#,]//g' | tr -d '\n';
	    echo -ne "\t";
	    cat /tmp/_f_.txt | sort -r -n -k $((2+$l+$p))  | head -n 1 | sed 's/[^-#,]//g'
	done

	# double seed here
	cat main.weight.full.l$l.txt  | grep "," | grep -P "(-*#){$w}[,](-*#){$w}[^,#-]" | tr "." "0" > /tmp/_f_.txt
	for (( p=0; p<$l; p++ ))
	do
	    printf "l:%2d\tw:%1d\tp:%2d/%2d\t" $l $w $p $l;
	    cat /tmp/_f_.txt | sort -r -n -k $((2+00+$p))  | head -n 1 | sed 's/[^-#,]//g' | tr -d '\n';
	    echo -ne "\t";
	    cat /tmp/_f_.txt | sort -r -n -k $((2+$l+$p))  | head -n 1 | sed 's/[^-#,]//g'
	done
    done
done
