1 COMM(1)                          User Commands                         COMM(1)
   2 
   3 NAME
   4      comm - select or reject lines common to two files
   5 
   6 SYNOPSIS
   7      comm [-123] file1 file2
   8 
   9 DESCRIPTION
  10      The comm utility reads file1 and file2, which must be ordered in the
  11      current collating sequence, and produces three text columns as output:
  12 
  13            o   lines only in file1;
  14 
  15            o   lines only in file2;
  16 
  17            o   lines in both files.
  18 
  19      If the input files were ordered according to the collating sequence of
  20      the current locale, the lines written will be in the collating sequence
  21      of the original lines.  If not, the results are unspecified.
  22 
  23      If either file1 or file2 is -, comm uses standard input starting at the
  24      current location.
  25 
  26 OPTIONS
  27      The following options are supported:
  28 
  29      -1            Suppresses the output column of lines unique to file1.
  30 
  31      -2            Suppresses the output column of lines unique to file2.
  32 
  33      -3            Suppresses the output column of lines common to both file1
  34                    and file2.
  35 
  36 OPERANDS
  37      The following operands are supported:
  38 
  39      file1         A path name of the first file to be compared.  If file1 is
  40                    -, the standard input is used.
  41 
  42      file2         A path name of the second file to be compared.  If file1 is
  43                    -, the standard input is used.
  44 
  45 EXIT STATUS
  46      The following exit values are returned:
  47 
  48      0       All input files were successfully output as specified.
  49 
  50      >0           An error occurred.
  51 
  52 EXAMPLES
  53      Example 1 Printing a list of utilities specified by files
  54 
  55         If file1, file2, and file3 each contain a sorted list of utilities,
  56         the command
  57 
  58             $ comm -23 file1 file2  | comm -23 - file3
  59 
  60         prints a list of utilities in file1 not specified by either of the
  61         other files.
  62 
  63         The command:
  64 
  65             $ comm -12 file1 file2 | comm -12 - file3
  66 
  67         prints a list of utilities specified by all three files; and the
  68         command:
  69 
  70             $ comm -12  file2 file3 | comm -23 -file1
  71 
  72         prints a list of utilities specified by both file2 and file3, but not
  73         specified in file1.
  74 
  75 ENVIRONMENT VARIABLES
  76      See environ(5) for descriptions of the following environment variables
  77      that affect the execution of comm: LANG, LC_ALL, LC_COLLATE, LC_CTYPE,
  78      LC_MESSAGES, LC_NUMERIC, and NLSPATH.
  79 
  80 INTERFACE STABILITY
  81      The command line interface of comm is Committed.  The output of comm is
  82      Committed.
  83 
  84 SEE ALSO
  85      cmp(1), diff(1), sort(1), uniq(1), attributes(5), environ(5),
  86      largefile(5), standards(5)
  87 
  88 illumos                        February 9, 2021                        illumos