#rm credits
# rule is name must be delimited from email, or other credits with a comma
for file in */*htm */*/*htm
do
	match=`grep -i CREDIT: $file`
	if [ $?==1 ] 
	then
	    echo  $match "|"  $file
	fi
done | sort | uniq | 
# done | sort | uniq | tee credits |
#cat credits |
awk '
    BEGIN {
	print "
"
	print " list of images sorted by contributor: "	
	print ""
	print ""
	print " "
	print "Index of image contributors:
"
	print ""
    }
    // {
	sub("Credit:","")
	gsub("<[^>]*>","")
	#gsub("{[^}]*}","")
	sub("^[ ]*","")
	split($0,a,"|")
	gsub(",.*$","",a[1])
	sub("[ ]*$","",a[1])
	if (a[1] != "") { 
	    CONTRIBUTOR[a[1]] = CONTRIBUTOR[a[1]] "|" a[2]
	    #print a[1]
	    #print "---->", a[2]
	}
	next
    }
    END {
	k=0
	for (contributor in CONTRIBUTOR)  {
	    sorted[k++] = contributor
	}
	isort(sorted,k-1);
	print ""
	print "
"
	print " Individual images by contributor 
"
	print "
"
	for (i=0; i ", sorted[i], ""
	    n=split(CONTRIBUTOR[sorted[i]],b,"|");
	    for(j=1; j<=n; j++) {
		gsub(" ","",b[j])
		printf("-   %s \n", b[j], b[j])
	    }
	    print ""
	}
	print "
 
"
	print "
"
	print ""
	print ""
	print "Rick Walker
"
	print ""
	print "rick_walker@omnisterra.com
"
	print ""
	print ""
    }
function  isort(A , n,    i, j, hold)
{
  # if needed a sentinal at A[0] will be created
  for( i = 2 ; i <= n ; i++)
  {
    hold = A[ j = i ]
    while ( A[j-1] > hold )
    { j-- ; A[j+1] = A[j] }
    A[j] = hold
  }
}
' > credits.htm