comparing text files

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hey all,

what are some straightfoward ways to compare 2 text files to see if there
are any differences?

thanks,
rodchar
 
Rodchar,

When you only want to know if they are unequal

Than my way to go will be:

First check if the length is unequal using the fileinfo, when they are
unequal probably you catch than more than 80%

To check if they are real equal, read it as two files with only readtoend.

And because it are strings a simple a = b should be enough

(When the files are to long you can do a readline and than match everytime
the line and exit when not true).

Equal files will take the longest time in this method.

Justs my idea

Cor
 
rodchar said:
what are some straightfoward ways to compare 2 text files to see if there
are any differences?

First, check if the files have the same length ('File.Length' or 'FileLen').
If the length is different, the file's contents are different. If the file
lengths are equal, read the data from both files line-by-line or blockwise
and compare the lines/blocks:

Reading a text file line-by-line or blockwise with a progress indicator
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=readfile&lang=en>
 
i think i'm wanting exact.

say textfile1 has the word "new" in it.
and textfile2 has the word "old" in it.

what's a delta list?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

comparing 2 columns 2
reading a text file 1
generic collection differencing 3
very subtle alignment question 4
Excel Comparing two columns 1
sb to text 14
comparing 2 sheets 3
line replacing ideas 3

Back
Top