Need command

I have two files File1, File2. File1 has whole list of IDs and File2 has a limited IDs. i need to compare these two files and take the IDs which are not present in File2 but present in File1. can someone tell me a command.

grep.

Maybe some script?

#!/bin/sh
cat $1 | while read LINE; do
 exist=`grep $LINE $2`
 if [ ! -z $exist ]; then
  echo $exist >> exists_in_file1.txt
 fi
done
server1 # ./diff.sh file1 file2

I assume that each line has only one ID. If your files are large, then performance of that script can be a problem.
Of course Scott has right and grep work fine too:

server1 # grep -f file1 file2
1 Like

Try

grep -vf File2 File1
1 Like