Compare two files, show lines in file1 but not in file2 [duplicate]

Let's say I have two files - file1 and file2. I want to compare those files, but output only lines that are in file1 and not in file2. How can I do it?

0

1 Answer

  1. Sort each file
  2. Use comm with the -23 option to show what's not in common, only the lines in file A which are not in file B; comm -23 fileA fileB

You Might Also Like