0

次のように2つの.propertiesファイルがあります

    first.properties                    second.properties
    -----------------                   ---------------------
    firstname=firstvalue                fourthname=fourthvalue
    secondname=secondvalue              sixthname=sixthvalue
    thirdname=thirdvalue                nineththname=ninethvalue
    fourthname=fourthvalue              tenthname=tenthvalue
    fifthname=fifthvalue
    sixthname=sixthvalue
    seventhname=seventhvalue

2 つのファイルを比較したいので、共通の名前と値のペアを first.properties から削除する必要があります。出力ファイルは次のようになります

    third.properties.
    ------------------ 
    firstname=firstvalue                
    secondname=secondvalue              
    thirdname=thirdvalue            
    fifthname=fifthvalue
    seventhname=seventhvalue

私は次のコードを使用しましたが、デカルト積のシナリオを与えています.上記を達成するために私を助けてください.

for /F "tokens=1,2 delims==" %%E in (first.properties) do (
    for /F "tokens=1,2 delims==" %%G in (second.properties) do (
    if "%%E" NEQ "%%G" echo %%E=%%F>>!HOME!\Properties\third.properties
    )
    )
4

2 に答える 2

0

これを試して:

findstr /vg:second.properties first.properties>third.properties
于 2013-05-29T04:08:25.970 に答える