#! /bin/ksh

abut g.dat p.dat w.dat |
	dm s1 s2 s3 s6 s9 |
		sed 's/Y+/+1.0/g
			s/Y-/+0.5/g
			s/Y/+1.0/g
			s/N-/-1.0/g
			s/N+/-0.5/g
			s/N/-1.0/g' | 
				dm "x3>0?'Y':'N'" "x4>0?'Y':'N'" "x5>0?'Y':'N'" INPUT "(x3+x4+x5)/3" |
					sed -e 's/	//' -e 's/	//' |
						colex 2 3 1 4 5 6 6.2n7 | 
							grep -v NNN

exit

echo "Ratings without regard to +/-"
echo "Who GG	GP	MW"
abut g.dat p.dat w.dat |
	tr '+-' '  ' |
		colex 3 6 9 |
			sort |
				uniq -c

echo "Ratings transformed into numbers from -1 to +1"
echo "(N-=-1 N=-1 N+=-.5  Y-=.5 Y=1 Y+=1)"

abut g.dat p.dat w.dat |
	sed 's/Y+/+1.0/g
		s/Y-/+0.5/g
		s/Y/+1.0/g
		s/N-/-1.0/g
		s/N+/-0.5/g
		s/N/-1.0/g' |
			dm s1 s2 s3 s6 s9 "(x3+x6+x9)/3" |
				sort -nr |
					uniq -c

echo "All papers with ratings of 1.0"

abut g.dat p.dat w.dat |
	sed 's/Y+/1.0/g
		s/Y-/0.5/g
		s/Y/1.0/g
		s/N-/-1.0/g
		s/N+/-0.5/g
		s/N/-1.0/g' |
			dm s1 s2 "if (x3+x6+x9)/3 = 1 then NIL else SKIP"  
