разный странный вывод - PullRequest
       7

разный странный вывод

0 голосов
/ 19 февраля 2019

У меня есть два файла следующим образом: 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

Я не уверен, что этот вывод означает здесь, поскольку они разные, но они находятся в одной строке, с "|»посередине.

Пожалуйста, дайте мне знать, если кто-нибудь знает почему.

Большое спасибо.

1 Ответ

0 голосов
/ 19 февраля 2019

Посмотрите документацию для 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!

Маркер |в основном указывает, что строка существует в обоих файлах, но была изменена.

В вашем примере алгоритм сравнения решил, что содержимое между двумя файлами в этой строке было достаточно похоже, чтобы они представляли одну и ту же строку, смодификаций.

...