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

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.

主站蜘蛛池模板: 丰顺县| 克山县| 宁乡县| 临西县| 玛纳斯县| 随州市| 东平县| 滦平县| 刚察县| 新宁县| 瑞金市| 专栏| 夏邑县| 富裕县| 沾益县| 银川市| 吴堡县| 双峰县| 兴隆县| 荔浦县| 岳阳县| 清水县| 克拉玛依市| 崇左市| 容城县| 涪陵区| 通化县| 甘洛县| 淮滨县| 灵山县| 榆社县| 治县。| 冀州市| 西平县| 永嘉县| 九寨沟县| 华阴市| 黎平县| 开封县| 安达市| 教育|