Sign in to follow this  
Followers 0
zvd

Diff

4 posts in this topic

#1 ·  Posted (edited)

What is the best way (if possible) to compare the contents of 2 text files, and output the difference? I'd like to do in AutoIT what the Unix command diff does so easily.

Edited by zvd

Share this post


Link to post
Share on other sites



Via what means are you comparing them? and what do the text files contain, Information line by line? etc.


[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

This would be challenging, there are windows versions of diff/grep...etc

MinGW has some, as does DJGPP

I'll attach diff at the end of this post

diff is really useful for making patches for text files. Imagine you have an AutoIt version 1.1 thats 100,000 lines long whoa! You fix a bug and now its version 1.2, instead of making me d/l the whole script over again, you can run diff between the 2 versions, which would make a tiny file containing only the differences, that can then be applied to a version 1.1 bringing it to 1.2

Example:

1.txt

Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9
Line 10

2.txt

Line 1
Line 2
Line 3
Line 4
Line 5
I'm different
Line 6
Line 7
Line 8
Line 9
Line 10

diff 1.txt 2.txt:

5a6
> I'm different

diff.zip

Edited by Ejoc

Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

Share this post


Link to post
Share on other sites

Thanks alot! The windows version of diff you attached does exactly what I'd like. (I searched the web for a utility like that for quite awhile but was unable to find one - small and free that is...)

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