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命令
python运行命令_对python中执行DOS命令的3种方法总结
1. 使用os.system("cmd") 特点是执行的时候程序会打出cmd在Linux上执行的信息. import os os.system("ls") 2. ...
python调用ping命令_在Python中调用Ping命令,批量IP的方法
#!/usr/bin/env python #coding:UTF-8 ''''''' Author: jefferchen@163.com 可在命令行直接带目的IP,也可将IP列表在文本文件中. p ...
python交互式命令_在python中运行交互式命令
如果正在与子进程生成的程序通信,则应签出Non-blocking read on a subprocess.PIPE in python.我的应用程序也遇到了类似的问题,发现使用队列是与子流程进行持续 ...
python的基础命令_深度学习中python常用命令
1. print大法 test = Hello World print ("test:" + test) 2. math和numpy的区别:math只对单个元素,numpy会bro ...
linux su无效_如何处理Linux中su命令无反应的情况
在前面的文章有介绍过su命令,su命令用于普通用户和超级用户的切换,但在有些系统中,使用su命令无反应,那么遇到这种情况该如何处理呢?下面随小编一起来看看Linux下su命令无反应的处理方法. 出现问 ...
linux 查找py文件命令_在 Linux 中如何从命令行查找 VirtualBox 版本
如果你想知道如何在 Linux 中从命令行查找 VirtualBox 版本,可以采用以下几种方法. -- Sk(作者) 我使用 Oracle VirtualBox 和 KVM 虚拟化程序 测试不同的 ...
linux tr 命令_在Linux中使用tr命令玩角色
linux tr 命令 tr command in Linux translates one set of characters to another. It can replace a charac ...
unix和linux命令_在Linux / UNIX中查找命令
unix和linux命令 The Linux find command comes in handy when looking for files directly from the command ...
linux wget 命令_在Linux中如何使用wget命令?
linux wget 命令 In this tutorial, let's learn how to download a file using the wget command in Linux. ...