|
Packit |
7cfc04 |
'\" et
|
|
Packit |
7cfc04 |
.TH COMM "1P" 2013 "IEEE/The Open Group" "POSIX Programmer's Manual"
|
|
Packit |
7cfc04 |
.SH PROLOG
|
|
Packit |
7cfc04 |
This manual page is part of the POSIX Programmer's Manual.
|
|
Packit |
7cfc04 |
The Linux implementation of this interface may differ (consult
|
|
Packit |
7cfc04 |
the corresponding Linux manual page for details of Linux behavior),
|
|
Packit |
7cfc04 |
or the interface may not be implemented on Linux.
|
|
Packit |
7cfc04 |
|
|
Packit |
7cfc04 |
.SH NAME
|
|
Packit |
7cfc04 |
comm
|
|
Packit |
7cfc04 |
\(em select or reject lines common to two files
|
|
Packit |
7cfc04 |
.SH SYNOPSIS
|
|
Packit |
7cfc04 |
.LP
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
comm \fB[\fR\(mi123\fB] \fIfile1 file2\fR
|
|
Packit |
7cfc04 |
.fi
|
|
Packit |
7cfc04 |
.SH DESCRIPTION
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.IR comm
|
|
Packit |
7cfc04 |
utility shall read
|
|
Packit |
7cfc04 |
.IR file1
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.IR file2 ,
|
|
Packit |
7cfc04 |
which should be ordered in the current collating sequence, and produce
|
|
Packit |
7cfc04 |
three text columns as output: lines only in
|
|
Packit |
7cfc04 |
.IR file1 ,
|
|
Packit |
7cfc04 |
lines only in
|
|
Packit |
7cfc04 |
.IR file2 ,
|
|
Packit |
7cfc04 |
and lines in both files.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
If the lines in both files are not ordered according to the collating
|
|
Packit |
7cfc04 |
sequence of the current locale, the results are unspecified.
|
|
Packit |
7cfc04 |
.SH OPTIONS
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.IR comm
|
|
Packit |
7cfc04 |
utility shall conform to the Base Definitions volume of POSIX.1\(hy2008,
|
|
Packit |
7cfc04 |
.IR "Section 12.2" ", " "Utility Syntax Guidelines".
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The following options shall be supported:
|
|
Packit |
7cfc04 |
.IP "\fB\(mi1\fP" 10
|
|
Packit |
7cfc04 |
Suppress the output column of lines unique to
|
|
Packit |
7cfc04 |
.IR file1 .
|
|
Packit |
7cfc04 |
.IP "\fB\(mi2\fP" 10
|
|
Packit |
7cfc04 |
Suppress the output column of lines unique to
|
|
Packit |
7cfc04 |
.IR file2 .
|
|
Packit |
7cfc04 |
.IP "\fB\(mi3\fP" 10
|
|
Packit |
7cfc04 |
Suppress the output column of lines duplicated in
|
|
Packit |
7cfc04 |
.IR file1
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.IR file2 .
|
|
Packit |
7cfc04 |
.SH OPERANDS
|
|
Packit |
7cfc04 |
The following operands shall be supported:
|
|
Packit |
7cfc04 |
.IP "\fIfile1\fR" 10
|
|
Packit |
7cfc04 |
A pathname of the first file to be compared. If
|
|
Packit |
7cfc04 |
.IR file1
|
|
Packit |
7cfc04 |
is
|
|
Packit |
7cfc04 |
.BR '\(mi' ,
|
|
Packit |
7cfc04 |
the standard input shall be used.
|
|
Packit |
7cfc04 |
.IP "\fIfile2\fR" 10
|
|
Packit |
7cfc04 |
A pathname of the second file to be compared. If
|
|
Packit |
7cfc04 |
.IR file2
|
|
Packit |
7cfc04 |
is
|
|
Packit |
7cfc04 |
.BR '\(mi' ,
|
|
Packit |
7cfc04 |
the standard input shall be used.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
If both
|
|
Packit |
7cfc04 |
.IR file1
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.IR file2
|
|
Packit |
7cfc04 |
refer to standard input or to the same FIFO special, block special, or
|
|
Packit |
7cfc04 |
character special file, the results are undefined.
|
|
Packit |
7cfc04 |
.SH STDIN
|
|
Packit |
7cfc04 |
The standard input shall be used only if one of the
|
|
Packit |
7cfc04 |
.IR file1
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.IR file2
|
|
Packit |
7cfc04 |
operands refers to standard input. See the INPUT FILES section.
|
|
Packit |
7cfc04 |
.SH "INPUT FILES"
|
|
Packit |
7cfc04 |
The input files shall be text files.
|
|
Packit |
7cfc04 |
.SH "ENVIRONMENT VARIABLES"
|
|
Packit |
7cfc04 |
The following environment variables shall affect the execution of
|
|
Packit |
7cfc04 |
.IR comm :
|
|
Packit |
7cfc04 |
.IP "\fILANG\fP" 10
|
|
Packit |
7cfc04 |
Provide a default value for the internationalization variables that are
|
|
Packit |
7cfc04 |
unset or null. (See the Base Definitions volume of POSIX.1\(hy2008,
|
|
Packit |
7cfc04 |
.IR "Section 8.2" ", " "Internationalization Variables"
|
|
Packit |
7cfc04 |
for the precedence of internationalization variables used to determine
|
|
Packit |
7cfc04 |
the values of locale categories.)
|
|
Packit |
7cfc04 |
.IP "\fILC_ALL\fP" 10
|
|
Packit |
7cfc04 |
If set to a non-empty string value, override the values of all the
|
|
Packit |
7cfc04 |
other internationalization variables.
|
|
Packit |
7cfc04 |
.IP "\fILC_COLLATE\fP" 10
|
|
Packit |
7cfc04 |
.br
|
|
Packit |
7cfc04 |
Determine the locale for the collating sequence
|
|
Packit |
7cfc04 |
.IR comm
|
|
Packit |
7cfc04 |
expects to have been used when the input files were sorted.
|
|
Packit |
7cfc04 |
.IP "\fILC_CTYPE\fP" 10
|
|
Packit |
7cfc04 |
Determine the locale for the interpretation of sequences of bytes of
|
|
Packit |
7cfc04 |
text data as characters (for example, single-byte as opposed to
|
|
Packit |
7cfc04 |
multi-byte characters in arguments and input files).
|
|
Packit |
7cfc04 |
.IP "\fILC_MESSAGES\fP" 10
|
|
Packit |
7cfc04 |
.br
|
|
Packit |
7cfc04 |
Determine the locale that should be used to affect the format and
|
|
Packit |
7cfc04 |
contents of diagnostic messages written to standard error.
|
|
Packit |
7cfc04 |
.IP "\fINLSPATH\fP" 10
|
|
Packit |
7cfc04 |
Determine the location of message catalogs for the processing of
|
|
Packit |
7cfc04 |
.IR LC_MESSAGES .
|
|
Packit |
7cfc04 |
.SH "ASYNCHRONOUS EVENTS"
|
|
Packit |
7cfc04 |
Default.
|
|
Packit |
7cfc04 |
.SH STDOUT
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.IR comm
|
|
Packit |
7cfc04 |
utility shall produce output depending on the options selected. If the
|
|
Packit |
7cfc04 |
.BR \(mi1 ,
|
|
Packit |
7cfc04 |
.BR \(mi2 ,
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR \(mi3
|
|
Packit |
7cfc04 |
options are all selected,
|
|
Packit |
7cfc04 |
.IR comm
|
|
Packit |
7cfc04 |
shall write nothing to standard output.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
If the
|
|
Packit |
7cfc04 |
.BR \(mi1
|
|
Packit |
7cfc04 |
option is not selected, lines contained only in
|
|
Packit |
7cfc04 |
.IR file1
|
|
Packit |
7cfc04 |
shall be written using the format:
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
"%s\en", <\fIline in file1\fR>
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
If the
|
|
Packit |
7cfc04 |
.BR \(mi2
|
|
Packit |
7cfc04 |
option is not selected, lines contained only in
|
|
Packit |
7cfc04 |
.IR file2
|
|
Packit |
7cfc04 |
are written using the format:
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
"%s%s\en", <\fIlead\fR>, <\fIline in file2\fR>
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
where the string <\fIlead\fP> is as follows:
|
|
Packit |
7cfc04 |
.IP <tab> 10
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.BR \(mi1
|
|
Packit |
7cfc04 |
option is not selected.
|
|
Packit |
7cfc04 |
.IP "null\ string" 10
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.BR \(mi1
|
|
Packit |
7cfc04 |
option is selected.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
If the
|
|
Packit |
7cfc04 |
.BR \(mi3
|
|
Packit |
7cfc04 |
option is not selected, lines contained in both files shall be written
|
|
Packit |
7cfc04 |
using the format:
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
"%s%s\en", <\fIlead\fR>, <\fIline in both\fR>
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
where the string <\fIlead\fP> is as follows:
|
|
Packit |
7cfc04 |
.IP <tab><tab> 10
|
|
Packit |
7cfc04 |
Neither the
|
|
Packit |
7cfc04 |
.BR \(mi1
|
|
Packit |
7cfc04 |
nor the
|
|
Packit |
7cfc04 |
.BR \(mi2
|
|
Packit |
7cfc04 |
option is selected.
|
|
Packit |
7cfc04 |
.IP <tab> 10
|
|
Packit |
7cfc04 |
Exactly one of the
|
|
Packit |
7cfc04 |
.BR \(mi1
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR \(mi2
|
|
Packit |
7cfc04 |
options is selected.
|
|
Packit |
7cfc04 |
.IP "null\ string" 10
|
|
Packit |
7cfc04 |
Both the
|
|
Packit |
7cfc04 |
.BR \(mi1
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR \(mi2
|
|
Packit |
7cfc04 |
options are selected.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
If the input files were ordered according to the collating sequence of
|
|
Packit |
7cfc04 |
the current locale, the lines written shall be in the collating
|
|
Packit |
7cfc04 |
sequence of the original lines.
|
|
Packit |
7cfc04 |
.SH STDERR
|
|
Packit |
7cfc04 |
The standard error shall be used only for diagnostic messages.
|
|
Packit |
7cfc04 |
.SH "OUTPUT FILES"
|
|
Packit |
7cfc04 |
None.
|
|
Packit |
7cfc04 |
.SH "EXTENDED DESCRIPTION"
|
|
Packit |
7cfc04 |
None.
|
|
Packit |
7cfc04 |
.SH "EXIT STATUS"
|
|
Packit |
7cfc04 |
The following exit values shall be returned:
|
|
Packit |
7cfc04 |
.IP "\00" 6
|
|
Packit |
7cfc04 |
All input files were successfully output as specified.
|
|
Packit |
7cfc04 |
.IP >0 6
|
|
Packit |
7cfc04 |
An error occurred.
|
|
Packit |
7cfc04 |
.SH "CONSEQUENCES OF ERRORS"
|
|
Packit |
7cfc04 |
Default.
|
|
Packit |
7cfc04 |
.LP
|
|
Packit |
7cfc04 |
.IR "The following sections are informative."
|
|
Packit |
7cfc04 |
.SH "APPLICATION USAGE"
|
|
Packit |
7cfc04 |
If the input files are not properly presorted, the output of
|
|
Packit |
7cfc04 |
.IR comm
|
|
Packit |
7cfc04 |
might not be useful.
|
|
Packit |
7cfc04 |
.SH EXAMPLES
|
|
Packit |
7cfc04 |
If a file named
|
|
Packit |
7cfc04 |
.BR xcu
|
|
Packit |
7cfc04 |
contains a sorted list of the utilities in this volume of POSIX.1\(hy2008, a file named
|
|
Packit |
7cfc04 |
.BR xpg3
|
|
Packit |
7cfc04 |
contains a sorted list of the utilities specified in the X/Open
|
|
Packit |
7cfc04 |
Portability Guide, Issue 3, and a file named
|
|
Packit |
7cfc04 |
.BR svid89
|
|
Packit |
7cfc04 |
contains a sorted list of the utilities in the System V Interface
|
|
Packit |
7cfc04 |
Definition Third Edition:
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
comm \(mi23 xcu xpg3 | comm \(mi23 \(mi svid89
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
would print a list of utilities in this volume of POSIX.1\(hy2008 not specified by either of the
|
|
Packit |
7cfc04 |
other documents:
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
comm \(mi12 xcu xpg3 | comm \(mi12 \(mi svid89
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
would print a list of utilities specified by all three documents, and:
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
comm \(mi12 xpg3 svid89 | comm \(mi23 \(mi xcu
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
would print a list of utilities specified by both XPG3 and the SVID,
|
|
Packit |
7cfc04 |
but not specified in this volume of POSIX.1\(hy2008.
|
|
Packit |
7cfc04 |
.SH RATIONALE
|
|
Packit |
7cfc04 |
None.
|
|
Packit |
7cfc04 |
.SH "FUTURE DIRECTIONS"
|
|
Packit |
7cfc04 |
None.
|
|
Packit |
7cfc04 |
.SH "SEE ALSO"
|
|
Packit |
7cfc04 |
.IR "\fIcmp\fR\^",
|
|
Packit |
7cfc04 |
.IR "\fIdiff\fR\^",
|
|
Packit |
7cfc04 |
.IR "\fIsort\fR\^",
|
|
Packit |
7cfc04 |
.IR "\fIuniq\fR\^"
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The Base Definitions volume of POSIX.1\(hy2008,
|
|
Packit |
7cfc04 |
.IR "Chapter 8" ", " "Environment Variables",
|
|
Packit |
7cfc04 |
.IR "Section 12.2" ", " "Utility Syntax Guidelines"
|
|
Packit |
7cfc04 |
.SH COPYRIGHT
|
|
Packit |
7cfc04 |
Portions of this text are reprinted and reproduced in electronic form
|
|
Packit |
7cfc04 |
from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
|
|
Packit |
7cfc04 |
-- Portable Operating System Interface (POSIX), The Open Group Base
|
|
Packit |
7cfc04 |
Specifications Issue 7, Copyright (C) 2013 by the Institute of
|
|
Packit |
7cfc04 |
Electrical and Electronics Engineers, Inc and The Open Group.
|
|
Packit |
7cfc04 |
(This is POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
|
|
Packit |
7cfc04 |
event of any discrepancy between this version and the original IEEE and
|
|
Packit |
7cfc04 |
The Open Group Standard, the original IEEE and The Open Group Standard
|
|
Packit |
7cfc04 |
is the referee document. The original Standard can be obtained online at
|
|
Packit |
7cfc04 |
http://www.unix.org/online.html .
|
|
Packit |
7cfc04 |
|
|
Packit |
7cfc04 |
Any typographical or formatting errors that appear
|
|
Packit |
7cfc04 |
in this page are most likely
|
|
Packit |
7cfc04 |
to have been introduced during the conversion of the source files to
|
|
Packit |
7cfc04 |
man page format. To report such errors, see
|
|
Packit |
7cfc04 |
https://www.kernel.org/doc/man-pages/reporting_bugs.html .
|