我正在寻找解决方案来比较两个文本文件,并将第二个文件中的不足行添加到第一个文件中。这是一个例子。VB.NET比较两个文本文件并添加不足的行
第一个文件的内容:
<category = Names>
Anton
Darell
Kate
</category>
<category = Job title>
Director
President
Manager
</category>
<category = other>
bla bla
lia lia
ohoho
</category>
第二个文件的内容:
<category = Names>
Anton
Frank
Thomas
</category>
<category = Job title>
Driver
President
Manager
</category>
<category = other>
bla bla
olia olia olia
</category>
如果你已经注意到每个文件有一些类型类别的,所以我想从第二个文件添加新的对象到First File中的相同类别新文件应如下所示:
<category = Names>
Anton
Darell
Kate
Frank
Thomas
</category>
<category = Job title>
Director
President
Manager
Driver
</category>
<category = other>
bla bla
lia lia
ohoho
olia olia olia
</category>
希望能够是可以解决的。
基本上你想写一个差异(比较)工具,也将做合并?已经有软件可以为你做这件事(BeyondCompare是我们在工作中使用的软件,但也有其他软件)。 – Tim 2013-04-21 01:01:35
这应该很容易实现。告诉我们你已经尝试过的东西,我们应该能够告诉你如何完成它。 – RBarryYoung 2013-04-21 01:12:52
我在考虑使用函数拆分,因此我可以将每个类别拆分为两个文件,然后进行比较,添加不足的行并将所有类别写回到一个文件中。我是VB初学者,这就是为什么我问这是可能的:) – Chelovek 2013-04-21 20:14:18