matching in loop

hello all,

this is probably very simple for you guys but i am trying to achive something like below...i have 2 files...file 1 has entries like below

DB1:NS
DB2:NS
DB3:NS
DB4
DB5:NS

and file2 as below

DB1
DB2
DB5

i was to write a loop statment were if there is a matching entry from 2 file do nothing else echo things from file2....example is, if(from file1) DB1 = DB1(file 2) then do nothing/exit or else echo file2 info...

i came up with below...but dose not work...

export FILE1=/oracle/tmp/ns
for db in `egrep -i ":NS" $FILE1`
do
echo "processing database: $db"
if [ -f /oracle/tmp/file2 ]; then
cat /oracle/tmp/file | while read LINE; do
if $db = $LINE; then
exit
else
echo "....................NOW PROCESSING INNER DB $LINE"
fi
done
fi
done

See if the below code is what you are looking to do:

$ cat find_match.sh
while IFS=":" read field1 field2
do
  grep -q $field1 t2
  if [ $? -eq 0 ]; then
    echo "$field1 found in t2"
  else
    echo "$field1 NOT found in t2"
  fi
done <t

$ cat t
DB1:NS
DB2:NS
DB3:NS
DB4
DB5:NS

$ cat t2
DB1
DB2
DB5

$ find_match.sh
DB1 found in t2
DB2 found in t2
DB3 NOT found in t2
DB4 NOT found in t2
DB5 found in t2