linux comm命令

Linux have a lot of tools to compare files. These tools provides a lot of powerful features to meet user needs. But sometimes just simple comparison is enough for some users. comm is a tool for this purpose . Comm only compare files and shows differences in a visual manner.

Linux有很多工具可以比较文件。 这些工具提供了许多强大的功能来满足用户需求。 但是有时候,对于某些用户而言,简单的比较就足够了。 comm是用于此目的的工具。 Comm仅比较文件并以可视方式显示差异。

句法 (Syntax)

We will use following syntax for comm command.

我们将对comm命令使用以下语法。

comm [OPTION]... FILE1 FILE2

帮帮我 (Help)

$ comm --help

Help
帮帮我

相比(Compare)

We will simply compare two files those have same and different lines. We just need to provide file names to the comm command. Here is our files.

我们将简单比较两个具有相同和不同行的文件。 我们只需要为comm命令提供文件名即可。 这是我们的文件。

a.txt (a.txt)

test
pof
apple
banana

b.txt (b.txt)

test
ok
apple
banana
lemon

Now we issue the command like below.

现在,我们发出如下命令。

$ comm a.txt b.txt

Compare
相比

As we can see the differences ok and lemon are printed in required column.

正如我们所看到的,“ ok和“ lemon的区别被打印在必填列中。

检查订单 (Check Order)

In previous example we see that there are some information about unsorted columns. comm command automatically checks the order of the provided text file. This can be disabled with --nocheck-order parameter.

在前面的示例中,我们看到一些有关未排序列的信息。 comm命令自动检查提供的文本文件的顺序。 可以使用--nocheck-order参数禁用此功能。

$ comm --nocheck-order a.txt b.txt

Do Check Order
检查订单

抑制列(Suppress Columns)

Columns can be suppressed with the suppress feature. We just need to provide column number to suppress like -1 , -2 , -3

可以使用抑制功能抑制列。 我们只需要提供列号来抑制-1-2-3

  • -1              suppress column 1 (lines unique to FILE1)-1抑制列1(FILE1独有的行)
  • -2              suppress column 2 (lines unique to FILE2)-2取消第2列(FILE2独有的行)
  • -3              suppress column 3 (lines that appear in both files)-3取消第3列(两个文件中均显示行)
$ comm -1 a.txt b.txt

Suppress Columns
抑制列
.u68c7dd7e31cea949144a46b0771f7025 , .u68c7dd7e31cea949144a46b0771f7025 .postImageUrl , .u68c7dd7e31cea949144a46b0771f7025 .centered-text-area { min-height: 80px; position: relative; } .u68c7dd7e31cea949144a46b0771f7025 , .u68c7dd7e31cea949144a46b0771f7025:hover , .u68c7dd7e31cea949144a46b0771f7025:visited , .u68c7dd7e31cea949144a46b0771f7025:active { border:0!important; } .u68c7dd7e31cea949144a46b0771f7025 .clearfix:after { content: ""; display: table; clear: both; } .u68c7dd7e31cea949144a46b0771f7025 { display: block; transition: background-color 250ms; webkit-transition: background-color 250ms; width: 100%; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #ECF0F1; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); } .u68c7dd7e31cea949144a46b0771f7025:active , .u68c7dd7e31cea949144a46b0771f7025:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #D35400; } .u68c7dd7e31cea949144a46b0771f7025 .centered-text-area { width: 100%; position: relative; } .u68c7dd7e31cea949144a46b0771f7025 .ctaText { border-bottom: 0 solid #fff; color: #3498DB; font-size: 16px; font-weight: bold; margin: 0; padding: 0; text-decoration: underline; } .u68c7dd7e31cea949144a46b0771f7025 .postTitle { color: #27AE60; font-size: 16px; font-weight: 600; margin: 0; padding: 0; width: 100%; } .u68c7dd7e31cea949144a46b0771f7025 .ctaButton { background-color: #e6e6e6!important; color: #3498DB; border: none; border-radius: 3px; box-shadow: none; font-size: 14px; font-weight: bold; line-height: 26px; moz-border-radius: 3px; text-align: center; text-decoration: none; text-shadow: none; width: 80px; min-height: 80px; background: url(https://www.poftut.com/wp-content/plugins/intelly-related-posts/assets/images/simple-arrow.png)no-repeat; position: absolute; right: 0; top: 0; } .u68c7dd7e31cea949144a46b0771f7025:hover .ctaButton { background-color: #E67E22!important; } .u68c7dd7e31cea949144a46b0771f7025 .centered-text { display: table; height: 80px; padding-left: 18px; top: 0; } .u68c7dd7e31cea949144a46b0771f7025 .u68c7dd7e31cea949144a46b0771f7025-content { display: table-cell; margin: 0; padding: 0; padding-right: 108px; position: relative; vertical-align: middle; width: 100%; } .u68c7dd7e31cea949144a46b0771f7025:after { content: ""; display: block; clear: both; }

LEARN MORE  How To Use windiff To Compare Contents Of Two Files In Windows with Examples?

.u68c7dd7e31cea949144a46b0771f7025 , .u68c7dd7e31cea949144a46b0771f7025 .postImageUrl , .u68c7dd7e31cea949144a46b0771f7025 .centered-text-area { min-height: 80px; position: relative; } .u68c7dd7e31cea949144a46b0771f7025 , .u68c7dd7e31cea949144a46b0771f7025:hover , .u68c7dd7e31cea949144a46b0771f7025:visited , .u68c7dd7e31cea949144a46b0771f7025:active { border:0!important; } .u68c7dd7e31cea949144a46b0771f7025 .clearfix:after { content: ""; display: table; clear: both; } .u68c7dd7e31cea949144a46b0771f7025 { display: block; transition: background-color 250ms; webkit-transition: background-color 250ms; width: 100%; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #ECF0F1; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); } .u68c7dd7e31cea949144a46b0771f7025:active , .u68c7dd7e31cea949144a46b0771f7025:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #D35400; } .u68c7dd7e31cea949144a46b0771f7025 .centered-text-area { width: 100%; position: relative; } .u68c7dd7e31cea949144a46b0771f7025 .ctaText { border-bottom: 0 solid #fff; color: #3498DB; font-size: 16px; font-weight: bold; margin: 0; padding: 0; text-decoration: underline; } .u68c7dd7e31cea949144a46b0771f7025 .postTitle { color: #27AE60; font-size: 16px; font-weight: 600; margin: 0; padding: 0; width: 100%; } .u68c7dd7e31cea949144a46b0771f7025 .ctaButton { background-color: #e6e6e6!important; color: #3498DB; border: none; border-radius: 3px; box-shadow: none; font-size: 14px; font-weight: bold; line-height: 26px; moz-border-radius: 3px; text-align: center; text-decoration: none; text-shadow: none; width: 80px; min-height: 80px; background: url(https://www.poftut.com/wp-content/plugins/intelly-related-posts/assets/images/simple-arrow.png)no-repeat; position: absolute; right: 0; top: 0; } .u68c7dd7e31cea949144a46b0771f7025:hover .ctaButton { background-color: #E67E22!important; } .u68c7dd7e31cea949144a46b0771f7025 .centered-text { display: table; height: 80px; padding-left: 18px; top: 0; } .u68c7dd7e31cea949144a46b0771f7025 .u68c7dd7e31cea949144a46b0771f7025-content { display: table-cell; margin: 0; padding: 0; padding-right: 108px; position: relative; vertical-align: middle; width: 100%; } .u68c7dd7e31cea949144a46b0771f7025:after { content: ""; display: block; clear: both; }

了解更多信息如何使用windiff在Windows中通过示例比较两个文件的内容?

翻译自: https://www.poftut.com/compare-files-comm-command-linux/

linux comm命令

linux comm命令_在Linux中使用Comm命令比较文件相关推荐

  1. python运行命令_对python中执行DOS命令的3种方法总结

    1. 使用os.system("cmd") 特点是执行的时候程序会打出cmd在Linux上执行的信息. import os os.system("ls") 2. ...

  2. python调用ping命令_在Python中调用Ping命令,批量IP的方法

    #!/usr/bin/env python #coding:UTF-8 ''''''' Author: jefferchen@163.com 可在命令行直接带目的IP,也可将IP列表在文本文件中. p ...

  3. python交互式命令_在python中运行交互式命令

    如果正在与子进程生成的程序通信,则应签出Non-blocking read on a subprocess.PIPE in python.我的应用程序也遇到了类似的问题,发现使用队列是与子流程进行持续 ...

  4. python的基础命令_深度学习中python常用命令

    1. print大法 test = Hello World print ("test:" + test) 2. math和numpy的区别:math只对单个元素,numpy会bro ...

  5. linux su无效_如何处理Linux中su命令无反应的情况

    在前面的文章有介绍过su命令,su命令用于普通用户和超级用户的切换,但在有些系统中,使用su命令无反应,那么遇到这种情况该如何处理呢?下面随小编一起来看看Linux下su命令无反应的处理方法. 出现问 ...

  6. linux 查找py文件命令_在 Linux 中如何从命令行查找 VirtualBox 版本

    如果你想知道如何在 Linux 中从命令行查找 VirtualBox 版本,可以采用以下几种方法. -- Sk(作者) 我使用 Oracle VirtualBox 和 KVM 虚拟化程序 测试不同的 ...

  7. linux tr 命令_在Linux中使用tr命令玩角色

    linux tr 命令 tr command in Linux translates one set of characters to another. It can replace a charac ...

  8. unix和linux命令_在Linux / UNIX中查找命令

    unix和linux命令 The Linux find command comes in handy when looking for files directly from the command ...

  9. linux wget 命令_在Linux中如何使用wget命令?

    linux wget 命令 In this tutorial, let's learn how to download a file using the wget command in Linux. ...

最新文章

  1. 为什么分布式一定要有消息队列?
  2. php编译成二进制文件_JVM字节码文件概述
  3. 中秋福利大放送!教你既可朝九晚五,又可诗和远方!
  4. chrome gwt1.7_快速提示:使用Chrome开发工具调试GWT应用程序
  5. bash下个人习惯的一些文件设置
  6. 【Pytorch神经网络实战案例】15 WGAN-gp模型生成Fashon-MNST模拟数据
  7. 计算所有1-100之间数字之和(偶数之和)代码
  8. Beyond Saliency map
  9. 光伏机器人最前线_送水、送药、送餐!哈市这些地方率先用上AI配送机器人(视频)...
  10. oozie timezone时区配置
  11. java读取局域网种大华摄像机信息
  12. 人脸识别门禁系统有哪些功能作用
  13. A Question of Ingestion(Dp)
  14. 什么是API接口平台?作用是什么?
  15. 货拉拉NLP算法实习生面经
  16. 【安全牛学习笔记】 端口扫描
  17. VIL100数据集处理
  18. android图片资源加密解密,Android Glide实现图片加密解密 自定义格式
  19. 对话 CTO | 服务万亿旅游市场,去哪儿网企业级运维的精益实践
  20. 使用暴风激活后首页被劫持

热门文章

  1. java编写数字游戏大全_Java编写猜数字小游戏
  2. JAXB学习笔记(一)
  3. Unity中的shadows(三)receive shadows
  4. 京东大幅下调iPhone XS系列售价,最高降价1700元
  5. 数字孪生在建筑工程行业的应用探索
  6. $.getJSON 解决跨域问题
  7. c语言中%c和%s的区别
  8. 《Linux系统调用:文件控制操作 fcntl》
  9. 几步教会你路径配合动画的制作
  10. 2021 CPSE | 鼎桥通信精彩亮相深圳会展中心