comm命令
2009-07-27 11:20
120 查看
今天在论坛看到帖子,才知道有这么个命令
,看来自己的知识太匮乏啊,为了让自己能记住一些,所以就查查资料,记录下来。
用法:comm [选项]... 文件1 文件2
逐行比较已排序的文件[文件1]和[文件2]。
With no options, produce three-column output. Column one contains
lines unique to FILE1, column two contains lines unique to FILE2,
and column three contains lines common to both files.
-1 suppress lines unique to FILE1
-2 suppress lines unique to FILE2
-3 suppress lines that appear in both files
--help 显示此帮助信息并退出
--version 输出版本信息并退出
请向 <bug-coreutils@gnu.org> 报告错误。
debian:/shell#
语 法:comm [-123][--help][--version][第1个文件][第2个文件]
补充说明:这项指令会一列列地比较两个已排序文件的差异,并将其结果显示出来,如果没有指定任何参数,则会把结果分成3行显示:第1行仅是在第1个
文件中出现过的列,第2行是仅在第2个文件中出现过的列,第3行则是在第1与第2个文件里都出现过的列。若给予的文件名称为"-",则comm指令会从标
准输入设备读取数据。
参 数:
-1 不显示只在第1个文件里出现过的列。
-2 不显示只在第2个文件里出现过的列。
-3 不显示只在第1和第2个文件里出现过的列。
--help 在线帮助。
--version 显示版本信息
debian:/shell# cat a1
1
2
3
4
5
6
debian:/shell# cat a2
1
2
3
4
7
8
debian:/shell# comm a1 a2
1
2
3
4
5
6
7
8
debian:/shell# comm -1 a1 a2
1
2
3
4
7
8
debian:/shell# comm -2 a1 a2
1
2
3
4
5
6
debian:/shell# comm -3 a1 a2
5
6
7
8
debian:/shell# comm -13 a1 a2
7
8
debian:/shell# comm -23 a1 a2
5
6
debian:/shell#
希望我不会遗忘!
debian:/shell# egrep -f a1 a2
1
2
3
4
debian:/shell# egrep -f a1 -v a2
7
8
debian:/shell# egrep -f a2 -v a1
5
6
debian:/shell#
,看来自己的知识太匮乏啊,为了让自己能记住一些,所以就查查资料,记录下来。
用法:comm [选项]... 文件1 文件2
逐行比较已排序的文件[文件1]和[文件2]。
With no options, produce three-column output. Column one contains
lines unique to FILE1, column two contains lines unique to FILE2,
and column three contains lines common to both files.
-1 suppress lines unique to FILE1
-2 suppress lines unique to FILE2
-3 suppress lines that appear in both files
--help 显示此帮助信息并退出
--version 输出版本信息并退出
请向 <bug-coreutils@gnu.org> 报告错误。
debian:/shell#
语 法:comm [-123][--help][--version][第1个文件][第2个文件]
补充说明:这项指令会一列列地比较两个已排序文件的差异,并将其结果显示出来,如果没有指定任何参数,则会把结果分成3行显示:第1行仅是在第1个
文件中出现过的列,第2行是仅在第2个文件中出现过的列,第3行则是在第1与第2个文件里都出现过的列。若给予的文件名称为"-",则comm指令会从标
准输入设备读取数据。
参 数:
-1 不显示只在第1个文件里出现过的列。
-2 不显示只在第2个文件里出现过的列。
-3 不显示只在第1和第2个文件里出现过的列。
--help 在线帮助。
--version 显示版本信息
debian:/shell# cat a1
1
2
3
4
5
6
debian:/shell# cat a2
1
2
3
4
7
8
debian:/shell# comm a1 a2
1
2
3
4
5
6
7
8
debian:/shell# comm -1 a1 a2
1
2
3
4
7
8
debian:/shell# comm -2 a1 a2
1
2
3
4
5
6
debian:/shell# comm -3 a1 a2
5
6
7
8
debian:/shell# comm -13 a1 a2
7
8
debian:/shell# comm -23 a1 a2
5
6
debian:/shell#
希望我不会遗忘!
debian:/shell# egrep -f a1 a2
1
2
3
4
debian:/shell# egrep -f a1 -v a2
7
8
debian:/shell# egrep -f a2 -v a1
5
6
debian:/shell#
相关文章推荐
- 【一天一个shell命令】文本操作系列-comm
- linux:使用comm命令比较两个文件:交集、差
- comm命令——
- comm命令:文件的交集与差集
- linux 文本文件的交集,差集 comm命令
- lastcomm:显示以前使用过的命令的信息
- 《Linux Shell 脚本攻略》学习日记-----comm命令进行文件比较
- 文本比较命令comm,diff
- Linux系统管理命令之lastcomm的使用
- linux:使用comm命令比较两个文件:交集、差
- Linux战地日记——comm命令和diff命令
- linux下的comm和diff命令:用来比较两个文件的不同之处
- linux shell comm命令的使用
- 比较两个UNIX文本文件,找出新增内容(diff和comm命令)(转)
- linux下的comm和diff命令:用来比较两个文件的不同之处
- comm命令
- 一天一个shell命令 文本操作系列-comm命令用法
- 图解Linux命令之--comm命令
- linux 比较文件相同部分comm命令和不同部分diff命令
- comm命令简介