While loop for comparison

hi all,
i have two files:
test1 contains : one two three four five (on separate lines)
test2 contains: one ten nine (on separate lines)

I want to compare two files, test1 against test2. if any word from test1 does not match test2 display it. can someone help me with a while loop on this.

thanks

This is not the appropriate forum for homework assignments.

Why would you insist on a while loop to perform comparisons? A very simple awk script would be easier (and more efficient than many common while loops that would perform this task).

thanks for your reply but for some reason my while read command doesnt seem to work ... not sure where i am getting it wrong

Is this a homework assignment?

What have you tried so far?

hi Don

here it is:

while read -r line
do
for i in $(cat test2)
do
if [ $line != $i ];
then
echo " The different value us $line"
fi
done
done < test1

i do not get the correct output. As per the my expectation i shud be getting all line from test1 except for the word "one". can you please help me correct the code. I am trying to extract lines from test1 that do not match lines in test2.

thanks in advacne