File 使用Beyond Compare 3或4逐行比较(忽略顺序)

File 使用Beyond Compare 3或4逐行比较(忽略顺序),file,comparison,beyondcompare3,File,Comparison,Beyondcompare3,我正在尝试使用Beyond Compare 3或4逐行比较文件中的内容。有一个警告。这些行在文件中的顺序不一定相同。举例如下: 示例1: File 1 contents: value1.key=mango value2.key=pear File 2 contents: value2.key=pear value1.key=mango This should say "files identical" on comparison. File 1 contents: value1.key=m

我正在尝试使用Beyond Compare 3或4逐行比较文件中的内容。有一个警告。这些行在文件中的顺序不一定相同。举例如下:

示例1:

File 1 contents:
value1.key=mango
value2.key=pear

File 2 contents:
value2.key=pear
value1.key=mango

This should say "files identical" on comparison.
File 1 contents:
value1.key=mango
value2.key=pear
value3.key=apple

File 2 contents:
value2.key=pear
value3.key=banana
value1.key=mango

This should report only the following in the comparison:
value3.key=apple | value3.key=banana
File 1 contents:
value1.key=mango
value2.key=pear
value3.key=apple

File 2 contents:
value3.key=apple
value1.key=mango

This should report only the following in the comparison:
value2.key=pear
示例2:

File 1 contents:
value1.key=mango
value2.key=pear

File 2 contents:
value2.key=pear
value1.key=mango

This should say "files identical" on comparison.
File 1 contents:
value1.key=mango
value2.key=pear
value3.key=apple

File 2 contents:
value2.key=pear
value3.key=banana
value1.key=mango

This should report only the following in the comparison:
value3.key=apple | value3.key=banana
File 1 contents:
value1.key=mango
value2.key=pear
value3.key=apple

File 2 contents:
value3.key=apple
value1.key=mango

This should report only the following in the comparison:
value2.key=pear
示例3:

File 1 contents:
value1.key=mango
value2.key=pear

File 2 contents:
value2.key=pear
value1.key=mango

This should say "files identical" on comparison.
File 1 contents:
value1.key=mango
value2.key=pear
value3.key=apple

File 2 contents:
value2.key=pear
value3.key=banana
value1.key=mango

This should report only the following in the comparison:
value3.key=apple | value3.key=banana
File 1 contents:
value1.key=mango
value2.key=pear
value3.key=apple

File 2 contents:
value3.key=apple
value1.key=mango

This should report only the following in the comparison:
value2.key=pear

有人能告诉我,使用超越比较法是否可以实现这一目标吗?

对于仍感兴趣的人:


比较文件时,您可以选择文件格式(从工具栏按钮“格式”),只需选择“排序”,即可实现这种比较。

如果允许您先对两个文件进行排序,则可以使用
diff
comm
,也可以使用Beyond Compare>进行排序(不过我对它不太熟悉)。如果您不能对文件进行排序,可以使用
awk
python
perl
来构建每个文件中行的哈希/映射/dict,然后检查它们是否等效……我已经考虑过了。我想知道我们是否可以不进行排序。还有{{sort}dos中的命令可用于对文件内容进行排序。这不适用于我的情况,但在Python中打开时,我可以将文件作为行列表加载,然后从列表中创建一组行,并减去这些行。我希望BeyondCompare将行作为集合加载,这不依赖于排序。