News for hackers. Stuff that matters.
Re:The most surprising Unix programs by nunoferreira on Sunday March 15, 2020 @08:24AM (#22583046)
What about "comm" - compare two sorted files line by line. You can easily get occurrences only in file 1, in both files, only in file 2.

Super powerful and saved me hours of work.

Re:The most surprising Unix programs by pimlottc on Sunday March 15, 2020 @08:34AM (#22583101)
comm is a really useful tool, with one big caveat — you must make sure your input files are all sorted the exact same way. If not, you can get unexpected results, and worse, might not even realize it.

This may seem obvious, but there are many tiny ways that sorts can differ between locales, operating systems and programs (e.g. Excel), especially when dealing with Unicode. It may look the same 99% of the time, and you may not realize until later that you’ve accidentally filtered out values.

Re:The most surprising Unix programs by TomNomNom on Sunday March 15, 2020 @10:36AM (#22583686)
My advice is to sort the files just-in-time using the shell:

    comm <(sort fileA.txt) <(sort fileB.txt)
Re:The most surprising Unix programs by nunoferreira on Sunday March 15, 2020 @08:54AM (#22583200)
Absolutely! From my experience I only use with listings from the same source with the same sort tool (mostly unix sort).
Re:The most surprising Unix programs by Hello71 on Sunday March 15, 2020 @11:05AM (#22583834)
GNU comm prints a warning if either file is not sorted, unless all input lines are pairable.
Re:The most surprising Unix programs by zamadatix on Sunday March 15, 2020 @10:43AM (#22583714)
Comm is perfect for scripting usage but you might find diff better for human usage. Added bonus diff also does binary.

Plus diff was in part written by the author of the linked content :).

Re:The most surprising Unix programs by loeg on Sunday March 15, 2020 @01:23PM (#22584834)
Comm operates on sets. Diff is a patch generator. They serve different needs. They're both useful!
Re:The most surprising Unix programs by TheGrassyKnoll on Sunday March 15, 2020 @11:16AM (#22583897)
You might enjoy tkdiff

  sudo apt-get install tkdiff