#! /bin/bash

ALL_RESULT_FILES=`find ./results -type f -name "*.uniq.txt"`

tablefile="./una_eval_table.csv"

for resfilepath in $ALL_RESULT_FILES; do

	targetdir_full=${resfilepath%/*}
	sourcedir_full=${targetdir_full%/*}
	sourcedir=${sourcedir_full##*/}
	sourcens=${sourcedir#*=}
	targetdir=${targetdir_full##*/}
	targetns=${targetdir#*=}

	cat $resfilepath | while read uniqline; do
		
		csvline="${sourcens},${targetns},${uniqline/ /,}"
		
		if ! [[ $uniqline == 1* ]]; then
			echo $csvline >> $tablefile
		fi
	done
done


