Tuesday, October 17, 2017

Find missing value from one file to another

To find a missing line (value) from one file compared to the other.

Using grep by combining the -v (show non-matching lines), -x (match whole lines) and -f (read patterns from file) options:
grep -v -x -f B.txt A.txt
This does not depend on the order of the files - it will remove any lines from A that match a line in B.