@echo on
setlocal

cd /d %~dp0
for /f "delims=" %%i in ('dir /s /b replacementDefine\*.original') do call :chk %%i

cd replacementDefine
fc /2 replacement_HIE_EN.properties.original_sort.txt replacement_HIE_JA.properties.original_sort.txt
fc /2 replacement_HIE_JA.properties.original_sort.txt replacement_HIJ_EN.properties.original_sort.txt
fc /2 replacement_HIJ_EN.properties.original_sort.txt replacement_HIJ_JA.properties.original_sort.txt
fc /2 replacement_HIJ_JA.properties.original_sort.txt replacement_HPE_EN.properties.original_sort.txt
fc /2 replacement_HPE_EN.properties.original_sort.txt replacement_HPE_JA.properties.original_sort.txt
fc /2 replacement_HPE_JA.properties.original_sort.txt replacement_HPJ_EN.properties.original_sort.txt
fc /2 replacement_HPJ_EN.properties.original_sort.txt replacement_HPJ_JA.properties.original_sort.txt
fc /2 replacement_HPJ_JA.properties.original_sort.txt replacement_HIE_EN.properties.original_sort.txt

goto :EOF


:chk

perl  -pe "s/=.*//g" %1>%1.txt
perl -i.bak -pe "s/#.*//g" %1.txt

perl -i.bak -ne "print $_ unless /^\s*$/" %1.txt
perl -i.bak -ne "print unless $hash{$_}++" %1.txt
perl -e "print sort <>" %1.txt >%1_sort.txt




goto :EOF

endlocal

