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