Skip to content

Instantly share code, notes, and snippets.

@lrhache
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lrhache/56e621ce4cb8e585ed58 to your computer and use it in GitHub Desktop.
Save lrhache/56e621ce4cb8e585ed58 to your computer and use it in GitHub Desktop.
Find all the missing lines from file B that are in file A
grep -F -x -v -f <file to compare:file B>.txt <base file:file A>.txt
# or:
comm <(sort fileB) <(sort fileA) -3 > output.txt
# prints lines that are both in file1 and file2 (intersection)
awk 'NR==FNR{a[$0];next} $0 in a' file1 file2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment