duanqiao2006 2010-05-06 13:30
浏览 113
已采纳

PHP代码比较两个大文本文件与~300,000个条目和输出差异

i've got two lists A and B, B = A + C - D. All elements are unique, no duplicates. How do i get the lists of:
(1) the new items added, C
(2) the old items removed, D

C and D aren't more than 10000 elements or so.

Edit

Crap, sorry guys - forgot the important detail - these are both text files, not in memory elements.

  • 写回答

6条回答 默认 最新

  • drxv39706 2010-05-07 04:02
    关注

    You said you already have two files A and B.

    Here's the easiest, fastest solution assuming you're running on a Unix system.

    system("comm -13 A B > C");
    system("comm -23 A B > D");
    
    //read C and D in PHP
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?

悬赏问题

  • ¥15 pip install后修改模块路径,import失败,需要在哪里修改环境变量?
  • ¥15 爬取1-112页所有帖子的标题但是12页后要登录后才能 我使用selenium模拟登录 账号密码输入后 会报错 不知道怎么弄了
  • ¥30 关于用python写支付宝扫码付异步通知收不到的问题
  • ¥50 vue组件中无法正确接收并处理axios请求
  • ¥15 隐藏系统界面pdf的打印、下载按钮
  • ¥15 MATLAB联合adams仿真卡死如何解决(代码模型无问题)
  • ¥15 基于pso参数优化的LightGBM分类模型
  • ¥15 安装Paddleocr时报错无法解决
  • ¥15 python中transformers可以正常下载,但是没有办法使用pipeline
  • ¥50 分布式追踪trace异常问题