Linux comm command details how to use Linux comm command

Source: Internet
Author: User

This command compares the differences between two sorted files in one column and displays the results. If no parameter is specified, the results are divided into three lines: rows 1st are only columns that have appeared in 1st files, and rows 2nd are columns that have only appeared in 2nd files, rows 3rd are columns that appear in files 1st and 2nd. If the given file name is "-", The comm command reads data from the standard input device.

Syntax

Comm [-123] [-- help] [-- version] [1st files] [2nd files]

Parameters:

  • -1 does not show columns that appear only in 1st files.
  • -2 do not show columns that appear only in 2nd files.
  • -3: columns that appear only in files 1st and 2nd are not displayed.
  • -- Help online help.
  • -- Version: displays the version information.

Instance

The content of aaa.txt and bbb.txt files is as follows:

[Root @ localhost text] # cat aaa.txt

Aaa

Bbb

Ccc

Ddd

Eee

111

222

[Root @ localhost text] # cat bbb.txt

Bbb

Ccc

Aaa

Hhh

Ttt

Jjj

<P> The output result of executing the comm command is as follows: </p>

[Root @ localhost text] # comm aaa.txt bbb.txt

Aaa

Bbb

Ccc

Aaa

Ddd

Eee

111

222

Hhh

Ttt

Jjj

First column second column third column

The same row in rows. Each column uses a tab (\ t) as the delimiter.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.