简体   繁体   English

Vb.net 比较两个文本文件和特定行

[英]Vb.net compare two text file and specific line

I am new in vb.net and now i am working on copy line and compare我是 vb.net 的新手,现在我正在研究复制线并进行比较

example: Step 1 compare all value line in A.txt with B.txt if B contain A value, value must remove in B示例:步骤 1 将 A.txt 中的所有值行与 B.txt 进行比较,如果 B 包含 A 值,则必须删除 B 中的值
Step 2 after remove we need to copy specific line from A to B like below result删除后的第 2 步,我们需要将特定行从 A 复制到 B,如下所示
A.txt: A.txt:
Line1 G 1G线
Line2 I 2号线
Line3 B 3号线B
Line4 A 4A线
Line5 O 5号线
B.txt B.txt
Line1 A 1A线
Line2 B线2B
Line3 C 3号线
Line4 D 4号线
Line5 G 5G线
result in C.txt shold be结果在 C.txt 应该是
Line1 G 1G线
Line2 C 2号线
Line3 B 3号线B
Line4 A 4A线
Line5 D 5号线

Hope you can give me a solution Thanks希望你能给我一个解决方案谢谢

This is an easy one.这是个简单的。 Not sure, if you have done anything till now.不确定,如果你到目前为止做过什么。 But here is the algorithm for you to start:但这是您开始的algorithm

  1. Read file A into array将文件 A 读入数组
  2. Read File B into array将文件 B 读入数组
  3. Compare array A and Array B. Add unique values to Array C比较数组 A 和数组 B。向数组 C 添加唯一值
  4. Write Array C to a text file.将数组 C 写入文本文件。

Once you've written code and have a code specific question, feel free to ask.一旦您编写了代码并有特定于代码的问题,请随时提出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM