comm.1 (1359B)
- .\" utils-std: Collection of commonly available Unix tools
- .\" Copyright 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- .\" SPDX-License-Identifier: MPL-2.0
- .Dd February 22, 2026
- .Dt COMM 1
- .Os
- .Sh NAME
- .Nm comm
- .Nd compare two sorted files line by line
- .Sh SYNOPSIS
- .Nm
- .Op Fl 123
- .Ar file1
- .Ar file2
- .Sh DESCRIPTION
- .Nm
- reads lines from
- .Ar file1
- and
- .Ar file2 ,
- and prints out their lines with no prefix when unique to
- .Ar file1 ,
- prefixed with one tab when unique to
- .Ar file2 ,
- prefixed with two tabs when common to both.
- .Pp
- Both
- .Ar file1
- and
- .Ar file2
- need to be sorted according to current locale.
- .Sh OPTIONS
- .Bl -tag -width _0
- .It Fl 1
- Suppress output of lines unique to
- .Ar file1 .
- .It Fl 2
- Suppress output of lines unique to
- .Ar file2 .
- .It Fl 3
- Suppress output of lines common to both
- .Ar file1
- and
- .Ar file2 .
- .El
- .Sh EXIT STATUS
- .Ex -std
- .Sh EXAMPLES
- Assuming a file named
- .Pa seq1_3.txt
- containing the output of
- .Ql seq 1 3 .
- Show lines only in
- .Pa seq1_3.txt ,
- lines only in stdin, and common lines:
- .Bd -literal -offset indent
- $ printf '0\en2\en5\en' | comm - seq1_3.txt
- 0
- 1
- 2
- 3
- 5
- .Ed
- .Sh SEE ALSO
- .Xr cmp 1 ,
- .Xr diff 1 ,
- .Xr sort 1 ,
- .Xr uniq 1
- .Sh STANDARDS
- .Nm
- should be compliant with the
- IEEE Std 1003.1-2024 (“POSIX.1”)
- specification.
- .Sh AUTHORS
- .An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me