1.

Solve : File Compare?

Answer»

Hello all,

I am using file compare on two text files. It seems to return the line previous to and the line following, as well as the line that's different. Is this correct? I don't find this noted in FC help info.

Thank,

SandyFC shows the differences in a dumb way. If you want to know the first place in a file where there is a difference, use a binary comparison.

CODE: [Select]C:\>type file1
hello
goodbye
different1

C:\>type file2
hello
goodbye
different2

C:\>fc file1 file2
Comparing files file1 and FILE2
***** file1
goodbye
different1
***** FILE2
goodbye
different2
*****

Code: [Select]C:\>fc /b file1 file2
Comparing files file1 and FILE2
00000019: 31 32
So then, I should see the line that's different, along with the line above and the line after it (if there is one)?

I apologize that I don't know how to read the binary result, if you could get me started with that.

Thanks.What is the reason for using FC? What are you trying to find out about the two files?
I'm running an invoice off of a system. I want to make sure the invoice is exactly like a previous run of that invoice.

I expected to see the run date was different. The additional lines threw me and I could not find anything different about them. Except that it appears to be including info from above and below the line of discrepancy. (A name edit had also taken place in the body of the invoice, so there was extraneous info there also). A bit confusing when you're only expecting to see what's different.

So I' was trying to confirm how FC works and that I'm not somehow missing something.



Actually, I had done a test with text and it returned the lines above and below the line of discrepancy. So I thought that's what was happening.

Looking at the real data:

* It is showing only the last 8 characters of the 136 character line above.

* What looks like it would be the line below the line of discrepancy (which has a name edit)
is actually the last 32 characters of that same line (which is 160 characters total).


Specifically how does FC report back?



Can anyone describe what FC would return when one line is different? Why don't you do some experiments?
I did do a controlled test to see what returned. The real data return seems different and I don't understand the result. So, I'm not understanding what FC is supposed to return when one line differs.

I'd like to know the syntax for the return if anyone knows it (can't seem to find it anywhere for some reason).

Quote from: sandy1000 on June 24, 2011, 09:49:17 AM

I did do a controlled test to see what returned. The real data return seems different and I don't understand the result. So, I'm not understanding what FC is supposed to return when one line differs.

I'd like to know the syntax for the return if anyone knows it (can't seem to find it anywhere for some reason).

What do you mean "if one line differs"? Do you mean 2 files which have exactly the same number of characters, in the same number of lines, but one line is different in one of the files? At the beginning, in the middle, or at the end? Or two one-line files, each different from the other? Or what?

The results below seem clear enough to me.

Text1.txt

Code: [Select]The prime minister, in Brussels for an EU summit where Greece's debt crisis is
among items on the agenda, SAID: "Britain is out of the euro - I think we will
stay out of the euro and certainly as long as I am doing this job there is no
prospect of Britain even contemplating JOINING the euro."
The Greek parliament has to pass fresh austerity measures next week before the
country can gain vital bail-out funds to prevent it defaulting on its loan
payments, due in mid-July.
Mr Blair told BBC One's Politics Show, in an interview to be broadcast on
Sunday, he had backed the idea of Britain joining the euro when he came to
power - but had accepted that the conditions had to be right.
Text2.txt - First line: lower case p changed to upper case.

Code: [Select]The Prime minister, in Brussels for an EU summit where Greece's debt crisis is
among items on the agenda, said: "Britain is out of the euro - I think we will
stay out of the euro and certainly as long as I am doing this job there is no
prospect of Britain even contemplating joining the euro."
The Greek parliament has to pass fresh austerity measures next week before the
country can gain vital bail-out funds to prevent it defaulting on its loan
payments, due in mid-July.
Mr Blair told BBC One's Politics Show, in an interview to be broadcast on
Sunday, he had backed the idea of Britain joining the euro when he came to
power - but had accepted that the conditions had to be right.
Text3.txt - 7th line: July changed to july

Code: [Select]The prime minister, in Brussels for an EU summit where Greece's debt crisis is
among items on the agenda, said: "Britain is out of the euro - I think we will
stay out of the euro and certainly as long as I am doing this job there is no
prospect of Britain even contemplating joining the euro."
The Greek parliament has to pass fresh austerity measures next week before the
country can gain vital bail-out funds to prevent it defaulting on its loan
payments, due in mid-july.
Mr Blair told BBC One's Politics Show, in an interview to be broadcast on
Sunday, he had backed the idea of Britain joining the euro when he came to
power - but had accepted that the conditions had to be right.
Text4.txt - Last line: had changed to Had

Code: [Select]The prime minister, in Brussels for an EU summit where Greece's debt crisis is
among items on the agenda, said: "Britain is out of the euro - I think we will
stay out of the euro and certainly as long as I am doing this job there is no
prospect of Britain even contemplating joining the euro."
The Greek parliament has to pass fresh austerity measures next week before the
country can gain vital bail-out funds to prevent it defaulting on its loan
payments, due in mid-July.
Mr Blair told BBC One's Politics Show, in an interview to be broadcast on
Sunday, he had backed the idea of Britain joining the euro when he came to
power - but Had accepted that the conditions had to be right.
Code: [Select]C:\>fc Text1.txt Text2.txt
Comparing files Text1.txt and TEXT2.TXT
***** Text1.txt
The prime minister, in Brussels for an EU summit where Greece's debt crisis is
among items on the agenda, said: "Britain is out of the euro - I think we will
***** TEXT2.TXT
The Prime minister, in Brussels for an EU summit where Greece's debt crisis is
among items on the agenda, said: "Britain is out of the euro - I think we will
*****


C:\>fc Text1.txt Text3.txt
Comparing files Text1.txt and TEXT3.TXT
***** Text1.txt
country can gain vital bail-out funds to prevent it defaulting on its loan
payments, due in mid-July.
Mr Blair told BBC One's Politics Show, in an interview to be broadcast on
***** TEXT3.TXT
country can gain vital bail-out funds to prevent it defaulting on its loan
payments, due in mid-july.
Mr Blair told BBC One's Politics Show, in an interview to be broadcast on
*****


C:\>fc Text1.txt Text4.txt
Comparing files Text1.txt and TEXT4.TXT
***** Text1.txt
Sunday, he had backed the idea of Britain joining the euro when he came to
power - but had accepted that the conditions had to be right.
***** TEXT4.TXT
Sunday, he had backed the idea of Britain joining the euro when he came to
power - but Had accepted that the conditions had to be right.
*****




This is in the middle of the file. The two files differ: Nicole and NICOL

Line 388 shows only the last 8 characters of the 136-char line above
Line 390 shows the last 32 chars of the end of line 389 (I removed some spaces from its 160 chars for viewing)

388: 70126 F
389: CN 00003336163300276801 SMITH, NICOLE 20110510 007076730 319.45
390: F+000000000+000000000

So, it looks like lines are limited to 128 characters. The line above shows the tail end after the first 128. The line below shows the overflow beyond 128 chars of the line that differs.

Rings a bell. It's been some time since I've used this but I do look at DOS text files well exceeding 128 character line lengths.

Now I know what I'm looking at! Could not compute yesterday ; )

Thanks.




Discussion

No Comment Found