Automating the comparison of text files

I have a set of log files (.txt) that I want to compare to new log files (they should be pretty much the same but there may be some differences that are OK and can be ignored). Currently I am producing the new log files then using the Compare PlugIn on Notepad++ and scrolling through to check the differences. Please can anyone suggest how this might be automated so only the differences I care about are highlighted and reported to me.

In Ruby, I use gem diff-lcs. Check the documentation.

For other languages, try web-search for “diff lcs <your_language>”.

1 Like

To be honest for such a simple task i would write a simple script in (i.e python) using difflib, it’s well explained there, but as @burdettelamar written it could be also done in Ruby, i think you would find solution to this problem in every possible language, cool feature to implement also would be, that the script would run automatically every time change to file is made and store it in some txt :wink:

Unix itself has a diff command:

And, naturally, you can chain the output into other Unix commands and do all kind of magic.