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.
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).
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.