inputDir=$1
outputFile=$2

if [ -f $outputFile ]; then
	rm $outputFile
fi

count=0
for inputFile in `ls $inputDir` 
do
	count=`expr $count + 1`
	cat $inputDir/$inputFile > nodelist.tmp
	if [ $count -eq 1 ]; then
		cat nodelist.tmp > union.tmp
	else
		./bin/set nodelist.tmp union.tmp AUB next.tmp 0
		rm union.tmp
		cat next.tmp > union.tmp
		rm next.tmp
	fi
	rm nodelist.tmp
#	wc -l union.tmp
done

#rm nodelist.tmp
mv union.tmp $outputFile

wc -l $outputFile