Jump to content

Comparing two text files


GWmellon
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...