1comm(1) User Commands comm(1)
2
3
4
6 comm - select or reject lines common to two files
7
9 comm [-123] file1 file2
10
11
13 The comm utility reads file1 and file2, which must be ordered in the
14 current collating sequence, and produces three text columns as output:
15 lines only in file1; lines only in file2; and lines in both files.
16
17
18 If the input files were ordered according to the collating sequence of
19 the current locale, the lines written will be in the collating sequence
20 of the original lines. If not, the results are unspecified.
21
23 The following options are supported:
24
25 -1 Suppresses the output column of lines unique to file1.
26
27
28 -2 Suppresses the output column of lines unique to file2.
29
30
31 -3 Suppresses the output column of lines duplicated in file1 and
32 file2.
33
34
36 The following operands are supported:
37
38 file1 A path name of the first file to be compared. If file1 is −,
39 the standard input is used.
40
41
42 file2 A path name of the second file to be compared. If file2 is −,
43 the standard input is used.
44
45
47 See largefile(5) for the description of the behavior of comm when
48 encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
49
51 Example 1 Printing a list of utilities specified by files
52
53
54 If file1, file2, and file3 each contain a sorted list of utilities, the
55 command
56
57
58 example% comm -23 file1 file2 | comm -23 - file3
59
60
61
62
63 prints a list of utilities in file1 not specified by either of the
64 other files. The entry:
65
66
67 example% comm -12 file1 file2 | comm -12 - file3
68
69
70
71
72 prints a list of utilities specified by all three files. And the entry:
73
74
75 example% comm -12 file2 file3 | comm -23 -file1
76
77
78
79
80 prints a list of utilities specified by both file2 and file3, but not
81 specified in file1.
82
83
85 See environ(5) for descriptions of the following environment variables
86 that affect the execution of comm: LANG, LC_ALL, LC_COLLATE, LC_CTYPE,
87 LC_MESSAGES, and NLSPATH.
88
90 The following exit values are returned:
91
92 0 All input files were successfully output as specified.
93
94
95 >0 An error occurred.
96
97
99 See attributes(5) for descriptions of the following attributes:
100
101
102
103
104 ┌─────────────────────────────┬─────────────────────────────┐
105 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
106 ├─────────────────────────────┼─────────────────────────────┤
107 │Availability │SUNWesu │
108 ├─────────────────────────────┼─────────────────────────────┤
109 │CSI │enabled │
110 ├─────────────────────────────┼─────────────────────────────┤
111 │Interface Stability │Standard │
112 └─────────────────────────────┴─────────────────────────────┘
113
115 cmp(1), diff(1), sort(1), uniq(1), attributes(5), environ(5), large‐
116 file(5), standards(5)
117
118
119
120SunOS 5.11 3 Mar 2004 comm(1)