On Tue, 27 Dec 2022, Reid wrote:
You could try something like `diff --changed-group-format='%<'
--unchanged-group-format=''`, or one of its variants. That example assumes
that the first file is the one you want lines from. Check the diff man
page under "--GTYPE-group-format=GFMT".
diff -y shows differences, but both files being compared. On the other hand
(besides four fingers and a thum) there's comm:
man comm:
NAME
comm - compare two sorted files line by line
SYNOPSIS
comm [OPTION]... FILE1 FILE2
DESCRIPTION
Compare sorted files FILE1 and FILE2 line by line.
When FILE1 or FILE2 (not both) is -, read standard input.
With no options, produce three-column output. Column one contains
lines unique to
FILE1, column two contains lines unique to FILE2, and column three
contains lines
common to both files.
-1 suppress column 1 (lines unique to FILE1)
-2 suppress column 2 (lines unique to FILE2)
-3 suppress column 3 (lines that appear in both files)
--check-order
It's really handy and will do what Ben wants.
Rich