Comm

来自 ChinaUnix Wiki

Linux命令:comm

功能说明:比较两个已排过序的文件。
语  法:comm [-123][--help][--version][第1个文件][第2个文件]

补充说明:这项指令会一列列地比较两个已排序文件的差异,并将其结果显示出来,如果没有指定任何参数,则会把结果分成3行显示:第1行仅是在第1个文件中出现过的列,第2行是仅在第2个文件中出现过的列,第3行则是在第1与第2个文件里都出现过的列。若给予的文件名称为"-",则comm指令会从标准输入设备读取数据。

参  数:
 -1   不显示只在第1个文件里出现过的列。
 -2   不显示只在第2个文件里出现过的列。
 -3   不显示只在第1和第2个文件里出现过的列。
 --help   在线帮助。
 --version   显示版本信息。 


英文版本,欢迎翻译:

ABOUT COMM

Select or reject lines common to two files.

SYNTAX

comm [-1] [-2] [-3 ] file1 file2

-1 Suppress the output column of lines unique to file1. -2 Suppress the output column of lines unique to file2. -3 Suppress the output column of lines duplicated in file1 and file2. file1 Name of the first file to compare. file2 Name of the second file to compare.

EXAMPLES

comm myfile1.txt myfile2.txt

The above example would compare the two files myfile1.txt and myfile2.txt.

个主工具