官术网_书友最值得收藏!

The comm command

The comm command shows the lines unique to file_1 and file_2 along with the common lines in them. We can use various options while using the command in the scripts:

    $ cat file_1
    Barack Obama
    David Cameron
    Narendra Modi
    
    $ cat file_2
    Barack Obama
    Angela Markel
    Vladimir Putin
    
    $ comm --nocheck-order file_1 file_2
          Barack Obama
      David Cameron
        Engela Merkel
      Narendra Modi
        Vladimir Putin
  

In the preceding example, we can see the following:

  • The first column shows the unique lines in file_1
  • The second column shows the unique lines in file_2
  • The last column shows the content common to both files

The output shows that the unique lines in file_1 are David Cameron and Narendra Modi. The unique lines in the second file are Engela Merkel and Vladimir Putin. The common name in both the files is Barack Obama, which is displayed in the third column.

主站蜘蛛池模板: 海阳市| 平江县| 宿迁市| 凉山| 庆云县| 青河县| 濉溪县| 上蔡县| 河北区| 名山县| 霍城县| 横峰县| 忻城县| 武威市| 固安县| 株洲县| 南川市| 阳曲县| 自治县| 高碑店市| 井研县| 自贡市| 包头市| 金山区| 晋宁县| 绥棱县| 宁南县| 东辽县| 正蓝旗| 靖远县| 拉萨市| 平阳县| 论坛| 甘肃省| 乌鲁木齐县| 龙游县| 胶南市| 大石桥市| 高平市| 同德县| 岐山县|