Comparing Files

comm

  • compare 2 text files
  • comm file1.txt file2.txt
  • -n to suppress colum(s)
  • Colum 1 = uniq lines in first file
  • Colum 2 = uniq lines in second file
  • Colum 3 = shared by both files

diff

  • show differences between 2 files
  • context format (-c)
  • unified format (-u)

vimdiff

  • Like diff context format, but in vim
  • Ctrl + W and then right arrow key: Switch Window
  • ] + C: Jump to next change
  • [ + C. Jump to previous change
  • D + O: Move change from other window to current one
  • D + P: Move change from current window to other one

Relevant Note(s): Linux Basics