In case you want to get the ksh script running, I'll comment on that. In your first try you were moving toward a solution where you repeatedly scanned a file. Don't do that. You want to read each file once. I think something like this will work:
Code:
i=0
exec < file1
while read array[i] ; do
((i=i+1))
done
exec <file2
while read entry ; do
i=0
found=0
while ((i<${#array[@]})) ; do
if [[ $entry = ${array[i]} ]] ; then
found=1
break
((i=i+1))
fi
done
if ((found)) ; then
echo $entry is in file1
else
echo $entry is not in file1
fi
done