Merge commit '008b34be09d7b9c3e7a18d3ce9ef8b5c4f4ff8b8'
[unleashed.git] / share / man / man1 / comm.1
blob9ef4e48acaba18374b5140949aa73b46a91e65b1
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright 1989 AT&T
44 .\" Portions Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.
45 .\" Copyright (c) 2004, Sun Microsystems, Inc.  All Rights Reserved.
46 .\"
47 .TH COMM 1 "Mar 3, 2004"
48 .SH NAME
49 comm \- select or reject lines common to two files
50 .SH SYNOPSIS
51 .LP
52 .nf
53 \fBcomm\fR [\fB-123\fR] \fIfile1\fR \fIfile2\fR
54 .fi
56 .SH DESCRIPTION
57 .sp
58 .LP
59 The \fBcomm\fR utility reads \fIfile1\fR and \fIfile2\fR, which must be ordered
60 in the current collating sequence, and produces three text columns as output:
61 lines only in \fIfile1\fR; lines only in \fIfile2\fR; and lines in both files.
62 .sp
63 .LP
64 If the input files were ordered according to the collating sequence of the
65 current locale, the lines written will be in the collating sequence of the
66 original lines. If not, the results are unspecified.
67 .SH OPTIONS
68 .sp
69 .LP
70 The following options are supported:
71 .sp
72 .ne 2
73 .na
74 \fB\fB-1\fR\fR
75 .ad
76 .RS 6n
77 Suppresses the output column of lines unique to \fIfile1\fR.
78 .RE
80 .sp
81 .ne 2
82 .na
83 \fB\fB-2\fR\fR
84 .ad
85 .RS 6n
86 Suppresses the output column of lines unique to \fIfile2\fR.
87 .RE
89 .sp
90 .ne 2
91 .na
92 \fB\fB-3\fR\fR
93 .ad
94 .RS 6n
95 Suppresses the output column of lines duplicated in \fIfile1\fR and
96 \fIfile2\fR.
97 .RE
99 .SH OPERANDS
102 The following operands are supported:
104 .ne 2
106 \fB\fIfile1\fR\fR
108 .RS 9n
109 A path name of the first file to be compared. If \fIfile1\fR is \fB\(mi\fR, the
110 standard input is used.
114 .ne 2
116 \fB\fIfile2\fR\fR
118 .RS 9n
119 A path name of the second file to be compared. If \fIfile2\fR is \fB\(mi\fR,
120 the standard input is used.
123 .SH USAGE
126 See \fBlargefile\fR(5) for the description of the behavior of \fBcomm\fR when
127 encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
128 .SH EXAMPLES
130 \fBExample 1 \fRPrinting a list of utilities specified by files
133 If \fIfile1\fR, \fIfile2\fR, and \fIfile3\fR each contain a sorted list of
134 utilities, the command
137 .in +2
139 example% \fBcomm -23 file1 file2  | comm -23 - file3\fR
141 .in -2
146 prints a list of utilities in \fIfile1\fR not specified by either of the other
147 files. The entry:
150 .in +2
152 example% \fBcomm -12 file1 file2 | comm -12 - file3\fR
154 .in -2
159 prints a list of utilities specified by all three files. And the entry:
162 .in +2
164 example% \fBcomm -12  file2 file3 | comm -23 -file1\fR
166 .in -2
171 prints a list of utilities specified by both \fIfile2\fR and \fIfile3\fR, but
172 not specified in \fIfile1\fR.
174 .SH ENVIRONMENT VARIABLES
177 See \fBenviron\fR(5) for descriptions of the following environment variables
178 that affect the execution of \fBcomm\fR: \fBLANG\fR, \fBLC_ALL\fR,
179 \fBLC_COLLATE\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
180 .SH EXIT STATUS
183 The following exit values are returned:
185 .ne 2
187 \fB\fB0\fR\fR
189 .RS 6n
190 All input files were successfully output as specified.
194 .ne 2
196 \fB\fB>0\fR\fR
198 .RS 6n
199 An error occurred.
202 .SH ATTRIBUTES
205 See \fBattributes\fR(5) for descriptions of the following attributes:
210 box;
211 c | c
212 l | l .
213 ATTRIBUTE TYPE  ATTRIBUTE VALUE
215 CSI     enabled
217 Interface Stability     Standard
220 .SH SEE ALSO
223 \fBcmp\fR(1), \fBdiff\fR(1), \fBsort\fR(1), \fBuniq\fR(1), \fBattributes\fR(5),
224 \fBenviron\fR(5), \fBlargefile\fR(5), \fBstandards\fR(5)