使用vbscript或其他任何方式以最快的方式比较两个csv文件? [英] Comparison of two csv files in fastest way using vbscript or any other way?

查看:103
本文介绍了使用vbscript或其他任何方式以最快的方式比较两个csv文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



如果您有任何想法使用vbscript或sql比较两个csv文件请分享。



基本上我们使用qtp,需要比较两个csv文件。

所以我希望比较最快的比较和提供报告的方式。



添加更多信息,

i需要根据主文件从文件1到文件2进行比较,如果不匹配则需要在输出中以红色打印该数据文件(html格式)以及两个文件中的整个记录​​然后继续下一个记录并再次进行比较....







谢谢,

最好的朋友

Hi All,

Please share if you have any idea to compare two csv files using vbscript or sql.

basically we are using qtp ,need to do comparison of two csv files.
so am looking to compare fastest way to compare and providing the report.

Adding more information,
i need to compare based on primary from file 1 to file2, if doesn't match then need to print that data in red color in the out put file(html format)along with entire record from two files and then continue to next record and do comparison again ....



Thanks,
Best friend

推荐答案

最快的方法是在命令提示符下执行以下操作:

The fastest way is to do the following on the command prompt :
c:\> fc.exe file1.csv file2.csv



但这实际上取决于你之后想要做什么,这是你未指定的。


But it really depends on what you want to do afterwards that counts, which you did not specify.


Dim text1 As String = My.Computer.FileSystem.ReadAllText("C:\file1.csv")
Dim text2 As String = My.Computer.FileSystem.ReadAllText("C:\file2.csv") 
If text1 <> text2 Then 
  ' Do something because they're not equal
End If


我想你想要逐行比较你的文件,你可以在SQL中做到但不能说它将是最快的进程。您将不得不尝试所有选项并得出哪一个最适合您的套件。



通过批量导入SQL DB表,其中将设置一个ROWID列作为标识,然后运行命令进行比较



I think you want your file to be compared line by line, You can do that in SQL but can not say that it will be fastest process. You would have to try all option and conclude which one best suites to you.

By bulk importing it in SQL DB tables which will have a ROWID column as identity been set, and then run a command to compare

select * from #file1 Join #file1 On #fil1e.ROwID=#file2.RowID
where #file1.Data<>#file2.Data 


这篇关于使用vbscript或其他任何方式以最快的方式比较两个csv文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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