加入两个文本文件,并按第1列和第2列更新重复的行 [英] join two text file and update the duplicate line by column1 and column 2

查看:63
本文介绍了加入两个文本文件,并按第1列和第2列更新重复的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都有连接两个文本文件的代码,并按列1和列2更新重复的行.

any one have the code for join two text file and update the duplicate line by column1 and column 2

推荐答案

您需要为这两种格式创建类,那么您需要将文件读取到这些类的数组中.然后,您可以在内存中使用它们并将其写出.您需要将文件格式的详细信息隐藏在一种方法中,然后可以从那里计算其余的内容.如果一个对象作为一个集合存在于另一个对象中(例如,一个父对象有很多孩子),则将一个类型的列表放入另一个类中,这样您就可以随时添加它们.我没有读过这个隐藏的代码转储,但这是使此代码可管理的工作.
You need to create classes for the two formats, then you need to read the files in to arrays of those classes. Then you can work with them in memory and write them out. You need to hide the details of your file format in to one method, then you can calculate the rest from there. If one object exists as a collection inside another ( like say a parent has many children ) then put a list of one type inside the other class, so you can add them as you go. I didn''t read this hige code dump, but that''s what you need to do to make this code managable.


这篇关于加入两个文本文件,并按第1列和第2列更新重复的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆