The example is confusing, as it just happens to result in 1 2 3,

$ printf '%s\n' 1 2 3 4     > file1
$ printf '%s\n'   2 3 4 5 6 > file2
$ comm --total -123 file1 file2
1       2       3       total

So please use

$ printf '%s\n' 0   2 3   5 6       > file1
$ printf '%s\n'   1 2   4   6 7 8 9 > file2
$ comm --total -123 file1 file2
3       5       2      total

Also add a note "However --total is a GNU extension. For a portable way
to make totals, use wc:

$ echo Lines only in 1st = $(comm -23 file1 file2 | wc -l)
$ echo Lines only in 2nd = $(comm -13 file1 file2 | wc -l)
$ echo Lines in both =     $(comm -12 file1 file2 | wc -l)



Reply via email to