文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>shell实现文件交并集

shell实现文件交并集

时间:2008-09-04  来源:ubuntuer

sort实现,sort -m可以合并已经排好序了的文件

并:sort -m <(sort file1 | uniq) <(sort file2 | uniq) | uniq
交:sort -m <(sort file1 | uniq) <(sort file2 | uniq) | uniq -d
差:sort -m <(sort file1 | uniq) <(sort file2 | uniq) <(sort file2 | uniq) | uniq -u

逛论坛发现的其它方法

     grep -f file1 file2
      第一个文件有而第二个文件没有的
     grep -fv file1 file2
      两个文件的并集
    cat file1 file2 | sort | uniq > file3

相关阅读 更多 +
排行榜 更多 +
秃秃鼠

秃秃鼠

游戏工具 下载
虚拟天文馆stellarium 1.15.0

虚拟天文馆stellarium 1.15.0

生活实用 下载
Local Dream

Local Dream

系统软件 下载