出于某种原因,diff没有像预期的那样响应-w选项;两个文件都是相同的,只是在XML头的末尾有一个新行。
我用-w选项调用diff,如下所示:
diff -w old_file.xml new_file.xml
# head -n4 old_file.xml
:
<?xml version="1.0" encoding="utf-8"?><survey audio_access_number="" custom="" name="test_conditionFormula" title="" type="CATI"><section id="1" loopover="None" notes="" startrecording="true" title="1">
<page id="1_Q1" loopover="None" notes="" title="1_Q1"><question id="Q1" number="Q1" style="vertical" text="1" uid="94">
<single id="single_409" number_response_columns="1" response_list="Q1_L1"/>
<instructions>Please select one</instructions>
# head -n4 new_file.xml
:
<?xml version="1.0" encoding="utf-8"?>
<survey audio_access_number="" custom="" name="test_conditionFormula" title="" type="CATI"><section id="1" loopover="None" notes="" startrecording="true" title="1">
<page id="1_Q1" loopover="None" notes="" title="1_Q1"><question id="Q1" number="Q1" style="vertical" text="1" uid="94">
<single id="single_409" number_response_columns="1" response_list="Q1_L1"/>
如果把旗交给diff,为什么会有不同的结果呢?