Linux 通讯命令

标签 linux comm

我确信这是一个简单的问题,但我只是不明白......

Ex.

  cat file1.txt
  abc
  def
  ghi

  cat file2.txt
  abc
  ghi
  klm

  comm file1.txt file2.txt

  So I know first column displays lines unique in file1
  Second : lines unique in file2
  Third: lines common in both

输出:

            abc
 def
            ghi
      klm

为什么第一列显示“def”?我感到困惑的是“线条独特”这句话。这意味着什么?我更多地考虑重复的意义,所以我认为所有 3 个单词都会显示在 file1 和 file2 的第 1 列和第 2 列中

最佳答案

文件 1 中唯一的行表示文件 1 中存在但文件 2 中不存在的行。 第一列显示 def,因为它是 file1 所特有的并且在 line2 中不存在

了解更多信息 https://en.wikipedia.org/wiki/Comm

关于Linux 通讯命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33192170/

相关文章:

linux - 删除“ID : string in bash

linux - 如何在 bash 中将我的 .txt 文件转换为 .json?

linux - 在 Ubuntu 上为 libtorrent 安装 Python3 绑定(bind)

linux - 如何解释 linux comm 命令的错误结果

java - 通过中兴通讯 GSM 调制解调器将短信立即转发到电脑

c - 伪终端问题(Mac/Linux): SIGTTOU & Inappropriate ioctl

android - Appium ERROR 转储失败,因为无法加载 Assets : Invalid file Support

unix - 如何将 comm 命令的输出放入 3 个单独的文件中?

bash - Unix 使用 comm 比较两个 CSV 文件

linux - Unix - 通过匹配前 91 个字符来获取文件 2 中不在文件 1 中的记录