开发者

Can't determine difference using diff

开发者 https://www.devze.com 2023-02-07 20:32 出处:网络
I have two files I\'m trying to compare which appear to be exactly the same, yet when I run diff on them I get the output below...

I have two files I'm trying to compare which appear to be exactly the same, yet when I run diff on them I get the output below...

After looking over this for the better part of an hour, I cannot determine what the difference is. I've even compared the two files one on top of the other using a transparent window app and can't see anything different. Any ideas? Am I missing something? Thanks

8c8
<  3 Molly Poultice                 / Ledasha Winnie                  121.88   42.62
---
>  3 Molly Poultice                 / Ledasha Winnie                  121.88   42.62
10c10
<  5 Charlie Anthony Fink           / Xavier Together                 121.33   42.42
---
>  5 Charlie Anthony Fink           / Xavier Together                 121.33   42.42
12,13c12,13
<                1     2     3     4     5     6     7     8     9    10    11    12    13
<                -     -     -     -     -     -     -     -     -    --    --    --    --
---
>                1     2开发者_如何学Python     3     4     5     6     7     8     9    10    11    12    13
>                -     -     -     -     -     -     -     -     -    --    --    --    --
15,16c15,16
< Board  1     8.5   8.5     0   8.5     2     6  ----    11     4     4   8.5     4     1
<              100   100  -500   100  -140    90  ----   150    50    50   100  PASS  -300
---
> Board  1     8.5   8.5     0   8.5     2     6  ----    11     4     4   8.5     4     1
>              100   100  -500   100  -140    90  ----   150    50    50   100  PASS  -300
18,19c18,19
< Board  2     7.5   9.5     2     2   7.5     5  ----    11     6     2   9.5     2     2
<              110   130  -140  -140   110  -110  ----   140   100  -140   130  -140  -140
---
> Board  2     7.5   9.5     2     2   7.5     5  ----    11     6     2   9.5     2     2
>              110   130  -140  -140   110  -110  ----   140   100  -140   130  -140  -140
21,22c21,22
< Board  3    ----  3.80   7.5    11  2.11   7.5   7.5   7.5   7.5  2.11     0  2.11   7.5
<             ----    80   110   140   -50   110   110   110   110   -50  -150   -50   110
---
> Board  3    ----  3.80   7.5    11  2.11   7.5   7.5   7.5   7.5  2.11     0  2.11   7.5
>             ----    80   110   140   -50   110   110   110   110   -50  -150   -50   110


Add the -b option to diff to ignore changes in whitespace and see if your files now match.


Was this text file moved between UNIX-like systems and MacOS or Windows? You may have line ending differences if the file was edited or written on different OSes. I would use od -x to do a hex dump of the first bit of each file and look at the diff of that.

For instance, the first different line is number 3 so do

head -3 <firstfile |od -x >firstfileshort
head -3 <lastfile |od -x >lastfileshort
diff firstfileshort lastfileshort


A likely reason for this is different line endings -- diff will show differences where one file has lines ending with \r\n (bytes 0x10 0x13), and another has lines ending with \n (just byte 0x13). One or the other file might also have extra spaces on the end of the lines where the other doesn't.

0

精彩评论

暂无评论...
验证码 换一张
取 消