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