comm(common)
comm(common)功能说明:比较两个已排过序的文件。
语 法:comm [-123][--help][--version][第1个文件][第2个文件]
补充说明:这项指令会一列列地比较两个已排序文件的差异,并将其结果显示出来,如果没有指定任何参数,则会把结果分成3行显示:第1行仅是在第1个文件中出现过的列,第2行是仅在第2个文件中出现过的列,第3行则是在第1与第2个文件里都出现过的列。若给予的文件名称为"-",则comm指令会从标准输入设备读取数据。
参 数:
-1 不显示只在第1个文件里出现过的列。
-2 不显示只在第2个文件里出现过的列。
-3 不显示只在第1和第2个文件里出现过的列。
--help 在线帮助。
--version 显示版本信息。
comm
comm [options] file1 file2
Compare lines common to the sorted files file1 and file2. Output is in three columns, from left to right: lines unique to file1, lines unique to file2, and lines common to both files. comm is similar to diff in that both commands compare two files. But comm can also be used like uniq; comm selects duplicate or unique lines between two sorted files, whereas uniq selects duplicate or unique lines within the same sorted file.
Options
Read the standard input.
Suppress printing of column num. Multiple columns may be specified and should not be space-separated.
Print help message and exit.
Print version information and exit.
Example
Compare two lists of top-10 movies, and display items that appear in both lists:
comm -12 siskel_top10 ebert_top10