Linux教程
Linux目录
Linux命令
Linux用户
Linux文件
Linux进程
Linux查询
Linux I/O
Linux正则
Linux安全
Linux shell
Linux网络
Linux VI
Linux 系统命令
Linux 其他

Linux comm

Linux comm

" comm"命令比较两个文件或流。默认情况下,"comm"将始终显示三列。第一栏表示第一文件的不匹配项,第二栏表示第二文件的不匹配项,第三栏表示两个文件的匹配项。这两个文件都必须按照排序顺序才能执行" comm"命令。
语法:
comm <file1> <file2>
示例:
comm file1.txt file2.txt
Linux Comm Filter1
请看上面的快照,
第一列显示的不是第一个文件'file1.txt'(Sehwag,Yuvi)的匹配项
第二列显示第二个文件'file2.txt'(Zadeja)的不匹配项
第三列表示两个文件(Dhoni,Dravid,Sachin)的匹配项

显示单个列

如果要输出单个列,则必须指定不显示的列数。
语法:
comm -23 (To display first column)
comm -13 (To display second column)
comm -12 (To display third column)
示例:
comm-23 file1.txt file2.txt
comm-13 file1.txt file2 .txt
comm-12 file1.txt file2.txt
Linux Comm Filter2
看看上面的快照," comm"命令中没有提到需要显示的列号。
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4