我有两个文件,如下所示: file1.txt
0000075d-7f2c-4896-83b4-5738d23bc4ba
000066c6-1184-47fc-acf6-916cb640c3f4
0000913e-adf2-41be-b377-749bd656cbf5
0000cb55-9b2c-42ea-af3e-87d2c7713c13
00012ac0-a893-41c7-a806-27728a1127e2
00013bea-4be2-4270-8efe-c00cd57b525d
00014c1d-6a5d-4c5e-aff0-a44cf49c54d5
0001d18b-c5c8-41c4-bcb0-e3c8074cb39e
00022848-b122-4c6a-b810-51737db09a5b
00022b1e-0148-4dad-bb82-a9be457ed2e7
file2.txt
0000075d-7f2c-4896-83b4-5738d23bc4ba
0000116d-4255-427c-9319-a60170770d40
000032d2-3795-4b38-a222-b6599061b467
00004090-fbf1-4fd5-80cc-1f34d45af7a1
0000456e-1070-46c0-83e4-6fff495b89a3
00005b49-5266-405e-b4d3-d9a441bc38e3
000066c6-1184-47fc-acf6-916cb640c3f4
000099a6-d457-47fb-a274-63eb566bfd44
00012ac0-a893-41c7-a806-27728a1127e2
00013bea-4be2-4270-8efe-c00cd57b525d
我跑步时
diff -y file1.txt file2.txt
我得到以下奇怪的输出:
0000075d-7f2c-4896-83b4-5738d23bc4ba 0000075d-7f2c-4896-83b4-5738d23bc4ba
> 0000116d-4255-427c-9319-a60170770d40
> 000032d2-3795-4b38-a222-b6599061b467
> 00004090-fbf1-4fd5-80cc-1f34d45af7a1
> 0000456e-1070-46c0-83e4-6fff495b89a3
> 00005b49-5266-405e-b4d3-d9a441bc38e3
000066c6-1184-47fc-acf6-916cb640c3f4 000066c6-1184-47fc-acf6-916cb640c3f4
0000913e-adf2-41be-b377-749bd656cbf5 | 000099a6-d457-47fb-a274-63eb566bfd44
0000cb55-9b2c-42ea-af3e-87d2c7713c13 <
00012ac0-a893-41c7-a806-27728a1127e2 00012ac0-a893-41c7-a806-27728a1127e2
00013bea-4be2-4270-8efe-c00cd57b525d 00013bea-4be2-4270-8efe-c00cd57b525d
00014c1d-6a5d-4c5e-aff0-a44cf49c54d5 <
0001d18b-c5c8-41c4-bcb0-e3c8074cb39e <
00022848-b122-4c6a-b810-51737db09a5b <
00022b1e-0148-4dad-bb82-a9be457ed2e7 <
此输出看起来很奇怪:
0000913e-adf2-41be-b377-749bd656cbf5 | 000099a6-d457-47fb-a274-63eb566bfd44
我不确定此输出在这里意味着什么,因为它们不同,但是它们在同一行中并带有“ |”在中间。
请让我知道是否有人知道为什么。
非常感谢。
答案 0 :(得分:0)
看看documentation for GNU diffutils,它提供了并排使用的标记的描述以及以下示例输出:
The Way that can be told of is n <
The name that can be named is no <
The Nameless is the origin of He The Nameless is the origin of He
The Named is the mother of all t | The named is the mother of all t
>
Therefore let there always be no Therefore let there always be no
so we may see their subtlety, so we may see their subtlety,
And let there always be being, And let there always be being,
so we may see their outcome. so we may see their outcome.
The two are the same, The two are the same,
But after they are produced, But after they are produced,
they have different names. they have different names.
> They both may be called deep and
> Deeper and more profound,
> The door of all subtleties!
|
标记基本上表明该行在两个文件中均已存在,但已被修改。
在您的示例中,差异算法确定该行上两个文件之间的内容足够相似,以至于它们代表了同一行,并且进行了修改。