xref: /original-bsd/usr.bin/comm/comm.1 (revision c3e32dec)
1.\" Copyright (c) 1989, 1990, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" the Institute of Electrical and Electronics Engineers, Inc.
6.\"
7.\" %sccs.include.redist.man%
8.\"
9.\"     @(#)comm.1	8.1 (Berkeley) 06/06/93
10.\"
11.Dd
12.Os
13.Dt COMM 1
14.Sh NAME
15.Nm comm
16.Nd select or reject lines common to two files
17.Sh SYNOPSIS
18.Nm comm
19.Op Fl 123
20.Ar file1 file2
21.Sh DESCRIPTION
22The
23.Nm comm
24utility reads
25.Ar file1
26and
27.Ar file2 ,
28which should be
29sorted lexically, and produces three text
30columns as output: lines only in
31.Ar file1 ;
32lines only in
33.Ar file2 ;
34and lines in both files.
35.Pp
36The filename ``-'' means the standard input.
37.Pp
38The following options are available:
39.Bl -tag -width Ds
40.It Fl 1
41Suppress printing of column 1.
42.It Fl 2
43Suppress printing of column 2.
44.It Fl 3
45Suppress printing of column 3.
46.El
47.Pp
48Each column will have a number of tab characters prepended to it
49equal to the number of lower numbered columns that are being printed.
50For example, if column number two is being suppressed, lines printed
51in column number one will not have any tabs preceding them, and lines
52printed in column number three will have one.
53.Pp
54.Nm Comm
55assumes that the files are lexically sorted; all characters
56participate in line comparisons.
57.Pp
58.Nm Comm
59exits 0 on success, >0 if an error occurred.
60.Sh SEE ALSO
61.Xr cmp 1 ,
62.Xr diff 1 ,
63.Xr sort 1 ,
64.Xr uniq 1
65.Sh STANDARDS
66The
67.Nm comm
68command is expected to be POSIX 1003.2 compatible.
69