The situation I have is that I need check that a text file generated contains the same records as a comparison file.

However the file records may not be in the same order, and don't need to be.

I could use Notepad++ to compare that two files contain all the exact same text, however this will show as different if they aren't in the same order.

Is there tool that will compare files lines that aren't in the same order?

  • "Data file", "file records"? What structure - lines of text, like a CSV?
    – user416
    Apr 22, 2015 at 6:36
  • 1
    What OS are you using? Do you need this to be gratis or can you pay for it (if yes, how much?) Apr 22, 2015 at 8:13
  • Also, how big are the files you want to compare? Apr 22, 2015 at 8:13
  • It's a good question. If no one can provide an answer, you may consider simply sorting both files, and then using a fork of WinMerge, specifically WinMerge 2011 by jtuc, available at bitbucket.org/jtuc/winmerge2011/downloads Apr 22, 2015 at 9:10

3 Answers 3


You could use a tool such as Textpad that allows you to sort the files as well as compare them - as long as the tool, (and you), doesn't save the file after the sort you should be OK.


The latest version of Notepad++ (v6.7.8.2) contains a 'order by' function.

This will be sufficient for your needs, so long as the header row isn't going to cause trouble in the ordering.

Note that the compare plugin has been removed though, so you'll need to download it from here.


The first thing that sprang to my mind was to sort the files, but that answer has already been suggested (twice). As an alternative, if the content is the same, then they will have the same checksum, so an MD5 checksum generator, such as the Microsoft File Checksum Integrity Verifier would be an alternative.

The Microsoft File Checksum Integrity Verifier tool is an unsupported command line utility that computes MD5 or SHA1 cryptographic hashes for files.

The only way for two files to generate the same MD5 or SHA1 is for their content to be identical (btw, I think that everyone here is assuming that whitespace is significant - is that correct?).

The beauty of this is that you can do it from the command line, without having to:

  1. open both files in an editor
  2. sort their contents
  3. compare the files
  4. abandon both edits (and hope that you never save by mistake)

Being command line based, you ought to be able to incorporate it into a batch file, if needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.