Get the App
SLTechnology News&Howtos  ›  Servers  › 

Linux basic command-comm

Shulou Source: shulou.com Published: 2022-06-02 07:02:27 10月03日 Update

Comm

Compare two sorted files line by line. The results are displayed in three columns: column 1 shows content that appears only in file1, column 2 shows content that appears only in file2, and column 3 shows content that appears at the same time. The scope of this command: RedHat, RHEL, Ubuntu, CentOS, SUSE, openSUSE, Fedora.

1. Grammar

Comm [OPTION]... FILE1 FILE2

2. List of options

Option

Description

-- version

Display command version information

-- help

Show help documentation

-1

Do not display what appears in the first file

-2

Do not display the contents of the second file

-3

Do not display simultaneous content

-- check-order

Check that the input is sorted correctly, even if all input lines have been paired

-- nocheck-order

Do not check whether the input is sorted correctly

-- output-delimiter=STR

Use STR to split columns

3. Examples

1) Direct comparison

[root@localhost weijie] # diff-y 1.c 2.c / / View two files

Abc | abd

Def | efg

Ghi | ghi

[root@localhost weijie] # comm 1.c 2.c / / comparison, these two files must have been sorted

Abc

Abd

Def

Efg

Ghi

2) display only the contents common to the two files

[root@localhost weijie] # comm-12 1.c 2.c

Ghi

A Linux learning platform has been made, and a prototype has come out at present, which you can refer to and use.

Link: https://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ password: n7bk

Tags: Content file two sort input command at the same time check information instance password platform document version result scope syntax scope link prototype Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi MySQL Linux OPPO Reno Docker