xref: /original-bsd/usr.bin/comm/comm.1 (revision 2c12987e)
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.3 (Berkeley) 06/11/90
7.\"
8.Dd
9.Os BSD 4.4
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.Tp Fl 1
37Suppress printing of column 1.
38.Tp Fl 2
39Suppress printing of column 2.
40.Tp Fl 3
41Suppress printing of column 3.
42.Tp
43.Pp
44Each column will have a number of tab characters prepended to it
45equal to the number of lower numbered columns that are being printed.
46For example, if column number two is being suppressed, lines printed
47in column number one will not have any tabs preceding them, and lines
48printed in column number three will have one.
49.Pp
50.Nm Comm
51assumes that the files are lexically sorted; all characters
52participate in line comparisons.
53.Pp
54.Nm Comm
55exits 0 on success, >0 if an error occurred.
56.Sh SEE ALSO
57.Xr cmp 1 ,
58.Xr diff 1 ,
59.Xr sort 1 ,
60.Xr uniq 1
61.Sh STANDARDS
62The
63.Nm comm
64function is expected to be POSIX 1003.2 compatible.
65