Read a value from a file

Hello All,

I am having the below txt file.

 
 stores.txt 
 12
 15
 45
 45
 50
 .
 .
 .
 .
 4564
 

Now I need to execute the below command to check whether the above numbers are present in an another file. And whatever numbers are not present, I need capture those numbers.

 
 For example 
 zgrep "|50|" sample.dat.gz 
 

Can you please help me to do this in a shell script? Thanks for the help !

With GNU-grep (not sure if -w is a standard option):

$ cat x.txt
4
500
30
15
$ cat stores.txt
12
15
45
45
50
90
$ grep -vwf x.txt stores.txt
12
45
45
50
90

The v option is used to display only non matching lines, the f option lets you specify a file for the patterns and the w option tells grep to match only whole words (without it 4 would match 45).

Thanks.
But my sample.dat.gz file will have the data as below.

01|US|45|03/17/2016|
01|US|20|03/17/2016|
01|US|785|03/17/2016|
01|US|15|03/17/2016|
zgrep -v -f <(awk '{printf("|%s|\n", $0)}' stores.txt)  sample.dat.gz

[/CODE]

try that.

If you need to work at a specified field level you need to be more explicit about what fields contain the data you want. This works for linux and only on whole records in the .gz file