*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> comm (1)              
Title
Content
Arch
Section
 

comm(1)

Contents


NAME    [Toc]    [Back]

       comm - Compares two sorted files.

SYNOPSIS    [Toc]    [Back]

       comm [-123] file1 file2

STANDARDS    [Toc]    [Back]

       Interfaces  documented  on  this reference page conform to
       industry standards as follows:

       command: XCU5.0

       Refer to the standards(5) reference page for more information
 about industry standards and associated tags.

OPTIONS    [Toc]    [Back]

       Suppresses  output  of  the  first  column (lines in file1
       only).  Suppresses output of the second column  (lines  in
       file2 only).  Suppresses output of the third column (lines
       common to file1 and file2).

       The command comm -123 produces no output.

OPERANDS    [Toc]    [Back]

       A pathname of the first file to be compared. If file1 is a
       hyphen (-), the standard input is used.  A pathname of the
       second file to be compared. If file2 is a hyphen (-),  the
       standard input is used.

       If  both file1 and file2 refer to standard input or to the
       same FIFO special,  block  special  or  character  special
       file, the results are undefined.

DESCRIPTION    [Toc]    [Back]

       The  comm  command  reads file1 and file2 and writes three
       columns to standard output, showing which lines are common
       to the files and which are unique to each.

       The leftmost column of standard output includes lines that
       are in file1 only.  The middle column includes lines  that
       are  in  file2  only.  The rightmost column includes lines
       that are in both file1 and file2.

       If you specify a hyphen (-) in place of one  of  the  file
       names, comm reads standard input.

       Generally,  file1  and file2 should be sorted according to
       the collating sequence specified by the  LC_COLLATE  environment
  variable.  (See sort(1).)  If the input files are
       not sorted properly, the output of comm might not be  useful.

EXIT STATUS    [Toc]    [Back]

       Successful completion.  Error occurred.







EXAMPLES    [Toc]    [Back]

       In  the  following  examples, file1 contains the following
       sorted list of North American cities:

              Anaheim Baltimore Boston Chicago  Cleveland  Dallas
              Detroit  Kansas City Milwaukee Minneapolis New York
              Oakland Seattle Toronto

              The second file, file2, contains this sorted list:

              Atlanta Chicago Cincinnati Houston Los Angeles Montreal
  New  York  Philadelphia Pittsburgh San Diego
              San Francisco St. Louis

              To display the lines unique to each file and common
              to the two files, enter: comm file1 file2

              This  command results in the following output: Anaheim
           Atlanta       Baltimore       Boston
                        Chicago       Cincinnati Cleveland Dallas
              Detroit      Houston Kansas City       Los  Angeles
              Milwaukee  Minneapolis       Montreal           New
              York  Oakland        Philadelphia        Pittsburgh
                   San  Diego      San Francisco Seattle      St.
              Louis Toronto

              The leftmost column contains lines in  file1  only,
              the middle column contains lines in file2 only, and
              the rightmost column contains lines common to  both
              files.  To display any one or two of the three output
 columns, include the appropriate flags to  suppress
  the  columns  you do not want.  For example,
              the following command  displays  columns  1  and  2
              only: comm -3 file1 file2

              Anaheim
                     Atlanta Baltimore Boston
                     Cincinnati Cleveland Dallas Detroit
                     Houston Kansas City
                     Los Angeles Milwaukee Minneapolis
                     Montreal Oakland
                     Philadelphia
                     Pittsburgh
                     San Diego
                     San Francisco Seattle
                     St. Louis Toronto

              The following command displays output from only the
              second column: comm -13 file1 file2

              Atlanta Cincinnati  Houston  Los  Angeles  Montreal
              Philadelphia Pittsburgh San Diego San Francisco St.
              Louis

              The following command displays output from only the
              third column: comm -12 file1 file2

              Chicago New York







SEE ALSO    [Toc]    [Back]

      
      
       Commands:  cmp(1), diff(1), sdiff(1), sort(1), uniq(1)



                                                          comm(1)
[ Back ]
 Similar pages
Name OS Title
cmp Tru64 Compares two files
diff3 Tru64 Compares three files
diff Tru64 Compares text files
sdiff Tru64 Compares two files and displays the differences in
comm HP-UX select or reject lines common to two sorted files
comm IRIX select or reject lines common to two sorted files
comm Linux compare two sorted files line by line
dircmp Tru64 Compares two directories
bsearch IRIX binary search a sorted table
look Tru64 Finds lines in a sorted list
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service