Sign in to follow this  
Followers 0
GWmellon

Comparing two text files

6 posts in this topic

I need to compare two text files and extract the items that are different. For example:

File 1 File2

12354.cdf 12354.cdf

56987.cdf 56987.cdf

98745.cdf 78954.cdf

01010.cdf 98745.cdf

01010.cdf

In this case the only one I want returned is 78954.cdf.

I am currently loading file 1 into an array and searching the array for each item in file 2. It works but for large files it is not speedy. I was wondering if there was a better, quicker way to do this. Seaching the array is a matter of five lines so that does not need to be optimized.

I am at the point were I have an ok grasp of AutoIt but still find myself spending an hour coding something and then suddenly discovering what I need in the help file. Not often but enough.

Share this post


Link to post
Share on other sites



Why reinvent the wheel http://winmerge.org/ :)


There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly

Share this post


Link to post
Share on other sites

Why reinvent the wheel http://winmerge.org/ :)

Errr, because this is a small part of a bigger program I am working on?

Share this post


Link to post
Share on other sites

Search the forum for "array" and "compare"...That is the easiest and fastest way. Read the two files into two arrays. Then compare the arrays...

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I am currently loading file 1 into an array and searching the array for each item in file 2. It works but for large files it is not speedy. I was wondering if there was a better, quicker way to do this.

If you are familiar with fc.exe you could use Run(@ComSpec...) and pipe the results to a file. If you don't know about fc.exe drop to a command line and type "fc.exe /?"

@ofLight - when I looked at that link, the first screenshot reminded me of PSPad and its TextDiff feature. You familar it it?

@DjDeep00 - you saying AutoIt reading and comparing large arrays is faster and easier than running a file compare (fc.exe) at the command line? Whoa, anyone with a way to test the speed of each? I'd be interested to know if comparing an array within Autoit is really the easiest and fastest method. I'm all about speed!!

Edited by ssubirias3

Share this post


Link to post
Share on other sites

DjDeep00 - Thanks, I'll give it a look.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0