Grep the non-matching lines

Hi,

I need to make a script to extract the number that are not in a file.

Example:
I have file-A that has 100000 (70000-799999) numbers. And a file-B with number that already are in the system. Now I need to know/get the numbers that are not in system.

I was thinking something like this:

cat file-A | grep -v "file-b" >> file-C but it is not posible to grep -v from a text file. Maybe a loop file ? :confused:

Advise please. tnx:)

file-A:
700000
700001
700002
700003
700004
700005
700006
700007
..
..
799997
799998
799999
File-B:
700002
700005
700010
799997
file-C:

 Invert the sense of matching, to select non-matching lines
grep -vf file-B file-A > file-C

It did not worked.

 
grep -vf list.txt range.txt > output.txt

have a look at the command

comm

Doesn't work? It certainly should.

$ cat file1
11
12
13
14
15
16
17
18
19
20
 
$ cat file2
12
14
16
18
 
$ grep -vf file2 file1
11
13
15
17
19
20

Tnx. it worked very easy with COMM command.

 
comm -3 file-A file-B >file-C
 
comm -3 range.txt list.txt >output.txt