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

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.

主站蜘蛛池模板: 黄石市| 泌阳县| 团风县| 桐城市| 玛多县| 桂东县| 白水县| 怀宁县| 平阴县| 曲水县| 翁源县| 临猗县| 云龙县| 萍乡市| 泾源县| 阜新市| 当阳市| 海口市| 贵定县| 白沙| 呼伦贝尔市| 阳信县| 黄龙县| 延川县| 林州市| 宁阳县| 怀柔区| 页游| 阿克苏市| 拉萨市| 禄丰县| 佛冈县| 临清市| 客服| 新丰县| 黄龙县| 饶阳县| 枣阳市| 托里县| 阳朔县| 遵化市|