1.\" $OpenBSD: comm.1,v 1.14 2009/02/08 17:15:09 jmc Exp $ 2.\" $NetBSD: comm.1,v 1.4 1995/03/26 09:25:50 glass Exp $ 3.\" 4.\" Copyright (c) 1989, 1990, 1993 5.\" The Regents of the University of California. All rights reserved. 6.\" 7.\" This code is derived from software contributed to Berkeley by 8.\" the Institute of Electrical and Electronics Engineers, Inc. 9.\" 10.\" Redistribution and use in source and binary forms, with or without 11.\" modification, are permitted provided that the following conditions 12.\" are met: 13.\" 1. Redistributions of source code must retain the above copyright 14.\" notice, this list of conditions and the following disclaimer. 15.\" 2. Redistributions in binary form must reproduce the above copyright 16.\" notice, this list of conditions and the following disclaimer in the 17.\" documentation and/or other materials provided with the distribution. 18.\" 3. Neither the name of the University nor the names of its contributors 19.\" may be used to endorse or promote products derived from this software 20.\" without specific prior written permission. 21.\" 22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32.\" SUCH DAMAGE. 33.\" 34.\" @(#)comm.1 8.1 (Berkeley) 6/6/93 35.\" 36.Dd $Mdocdate: February 8 2009 $ 37.Dt COMM 1 38.Os 39.Sh NAME 40.Nm comm 41.Nd select or reject lines common to two files 42.Sh SYNOPSIS 43.Nm comm 44.Op Fl 123f 45.Ar file1 file2 46.Sh DESCRIPTION 47The 48.Nm 49utility reads 50.Ar file1 51and 52.Ar file2 , 53which should be 54sorted lexically, and produces three text 55columns as output: lines only in 56.Ar file1 ; 57lines only in 58.Ar file2 ; 59and lines in both files. 60.Pp 61The filename 62.Sq - 63means the standard input. 64.Pp 65The options are as follows: 66.Bl -tag -width Ds 67.It Fl 1 68Suppress printing of column 1. 69.It Fl 2 70Suppress printing of column 2. 71.It Fl 3 72Suppress printing of column 3. 73.It Fl f 74Fold case in line comparisons. 75.El 76.Pp 77Each column will have a number of tab characters prepended to it 78equal to the number of lower numbered columns that are being printed. 79For example, if column number two is being suppressed, lines printed 80in column number one will not have any tabs preceding them, and lines 81printed in column number three will have one. 82.Pp 83.Nm 84assumes that the files are lexically sorted; all characters 85participate in line comparisons. 86.\" .Sh ENVIRONMENT 87.\" .Bl -tag -width indent 88.\" .It Ev LANG 89.\" .It Ev LC_ALL 90.\" .It Ev LC_CTYPE 91.\" .It Ev LC_COLLATE 92.\" .It Ev LC_MESSAGES 93.\" .El 94.Pp 95.Ex -std comm 96.Sh SEE ALSO 97.Xr cmp 1 , 98.Xr diff 1 , 99.Xr sort 1 , 100.Xr uniq 1 101.Sh STANDARDS 102The 103.Nm 104utility conforms to 105.St -p1003.1-2008 . 106.Pp 107The flag 108.Op Fl f 109is an extension to that specification. 110.Sh HISTORY 111A 112.Nm 113command appeared in 114.At v4 . 115