Get lines only found in first file, saving the result to a third file

comm

  • Select or reject lines common to two files. Both files must be sorted.
    More information: <https://www.gnu.org/software/coreutils/comm>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

comm -23 {{file1}} {{file2}} > {{file1_only}}

click the source code to copy install comm on any operating system with command-not-found.com