- 论坛徽章:
- 0
|
本帖最后由 gdutllf2006 于 2011-07-08 15:21 编辑
文件比较
ocs.unl:
3320577777|923125871352|
3320577777|923125871353|
3320577777|923125871354|
3344556679|923331234562|
3344556679|923331234533|
cares.unl
3320577777|923125871352|
3320577777|923331234564|
3344556679|923331234562|
3344556679|923331234560|
需要输出文件:
both.unl: 两边都存在的号码
3320577777|923125871352|
3344556679|923331234562|
in_ocs_notin_cares.unl: 在ocs.unl不在cares.unl中
3320577777|923125871353|
3320577777|923125871354|
3344556679|923331234533|
notin_ocs_in_cares.unl:不在ocs.unl在cares.unl中
3320577777|923331234564|
3344556679|923331234560|
命令如下:大家看有没有问题,现在没有环境测试, 如不行,看如何来实现??
sort -t"|" -k1,1n -k2n ocs.unl > ocs.unl.1
sort -t"|" -k1,1n -k2n cares.unl > cares.unl.1
comm -12 ocs.unl.1 cares.unl.1 > both.unl
comm -23 ocs.unl.1 cares.unl.1 > in_ocs_notin_cares.unl
comm -13 ocs.unl.1 cares.unl.1 > notin_ocs_in_cares.unl |
|