diff --git a/tools/diff.sh b/tools/diff.sh new file mode 100644 index 0000000..2f54b3a --- /dev/null +++ b/tools/diff.sh @@ -0,0 +1,78 @@ +process_files() { + for file in "$1"/*; do + if [ -d "$file" ]; then + # 如果是目录,则递归调用函数 + process_files "$file" + elif [ -f "$file" ]; then + # 如果是文件,检查是否为文本文件 + if [[ $file == *.txt ]]; then + echo "$file is a text file." + # original_tag = xxx + sed -i 's/original_tag = ENG/original_tag = HUJ/g' "$file" + sed -i 's/original_tag = USA/original_tag = BYG/g' "$file" + sed -i 's/original_tag = CHI/original_tag = DOH/g' "$file" + sed -i 's/original_tag = PRC/original_tag = DOH/g' "$file" + sed -i 's/original_tag = SOV/original_tag = BFL/g' "$file" + sed -i 's/original_tag = GER/original_tag = TIX/g' "$file" + sed -i 's/original_tag = FRA/original_tag = YUW/g' "$file" + sed -i 's/original_tag = JAP/original_tag = CHY/g' "$file" + sed -i 's/original_tag = ITA/original_tag = SAD/g' "$file" + # has_war_with = xxx + sed -i 's/has_war_with = ENG/has_war_with = HUJ/g' "$file" + sed -i 's/has_war_with = USA/has_war_with = BYG/g' "$file" + sed -i 's/has_war_with = CHI/has_war_with = DOH/g' "$file" + sed -i 's/has_war_with = PRC/has_war_with = DOH/g' "$file" + sed -i 's/has_war_with = SOV/has_war_with = BFL/g' "$file" + sed -i 's/has_war_with = GER/has_war_with = TIX/g' "$file" + sed -i 's/has_war_with = FRA/has_war_with = YUW/g' "$file" + sed -i 's/has_war_with = JAP/has_war_with = CHY/g' "$file" + sed -i 's/has_war_with = ITA/has_war_with = SAD/g' "$file" + # tag = xxx + sed -i 's/tag = ENG/tag = HUJ/g' "$file" + sed -i 's/tag = USA/tag = BYG/g' "$file" + sed -i 's/tag = CHI/tag = DOH/g' "$file" + sed -i 's/tag = PRC/tag = DOH/g' "$file" + sed -i 's/tag = SOV/tag = BFL/g' "$file" + sed -i 's/tag = GER/tag = TIX/g' "$file" + sed -i 's/tag = FRA/tag = YUW/g' "$file" + sed -i 's/tag = JAP/tag = CHY/g' "$file" + sed -i 's/tag = ITA/tag = SAD/g' "$file" + # TAG = xxx + sed -i 's/TAG = ENG/tag = HUJ/g' "$file" + sed -i 's/TAG = USA/tag = BYG/g' "$file" + sed -i 's/TAG = CHI/tag = DOH/g' "$file" + sed -i 's/TAG = PRC/tag = DOH/g' "$file" + sed -i 's/TAG = SOV/tag = BFL/g' "$file" + sed -i 's/TAG = GER/tag = TIX/g' "$file" + sed -i 's/TAG = FRA/tag = YUW/g' "$file" + sed -i 's/TAG = JAP/tag = CHY/g' "$file" + sed -i 's/TAG = ITA/tag = SAD/g' "$file" + # other = xxx + sed -i 's/other = ENG/other = HUJ/g' "$file" + sed -i 's/other = USA/other = BYG/g' "$file" + sed -i 's/other = CHI/other = DOH/g' "$file" + sed -i 's/other = PRC/other = DOH/g' "$file" + sed -i 's/other = SOV/other = BFL/g' "$file" + sed -i 's/other = GER/other = TIX/g' "$file" + sed -i 's/other = FRA/other = YUW/g' "$file" + sed -i 's/other = JAP/other = CHY/g' "$file" + sed -i 's/other = ITA/other = SAD/g' "$file" + # Others + sed -i 's/ ENG / HUJ /g' "$file" + sed -i 's/ USA / BYG /g' "$file" + sed -i 's/ CHI / DOH /g' "$file" + sed -i 's/ PRC / DOH /g' "$file" + sed -i 's/ SOV / BFL /g' "$file" + sed -i 's/ GER / TIX /g' "$file" + sed -i 's/ FRA / YUW /g' "$file" + sed -i 's/ JAP / CHY /g' "$file" + sed -i 's/ ITA / SAD /g' "$file" + + fi + fi + done +} + +# 调用函数,从指定目录开始 +process_files src +