Diff command file entries in different lines

Hello,

I have two files to compare these contain some contents like this :

FIle 1 :
A
B
C
E

File 2 has some new entries and the old entries are in some different ordre

File 2 could be like this :
C
E
A
B
G
I

How can I use diff command to only get the entries in file 2 that are new , so I dont want to know at which line the files differ, but only the entries in 2 that do not match any entries in 1.??

Note : These files provided here are just examples, but in reality the size of 1 and 2 could be very large, (say 900 entries or more)

Run sort on both files and then use comm . You could also use grep fixed-string full-line matching, with the first file as a pattern file and the second file as the data. This could also be done with awk , by storing each record from the first file in an array and then testing each line from the second file for membership in that array. diff , however, is the wrong tool for the job.

Regards,
Alister

Thank you for your help. I used sort and comm and it worked.

You're welcome.

Regards,
Alister

you can also do like this (for diff)

awk 'NR == FNR { A[$0]=1; next } !A[$0]' file1 file2
G
I