Skip to content
Advertisement

How to find which line is missing in another file

on Linux box I have one file as below A.txt

1
2
3
4

Second file as below B.txt

1
2
3
6

I want to know what is inside A.txt but not in B.txt i.e. it should print value 4

I want to do that on Linux.

Advertisement

Answer

awk 'NR==FNR{a[$0]=1;next}!a[$0]' B A

didn’t test, give it a try

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement