Use https://tlwiki.org/?title=Tools#RScript with an insanely high line length like 5000 so that line breaks aren't added to the script for no reason. Use also, to clean up control formatting (modify as needed): {{{#!python #!python import sys import re for name in sys.argv[1:]: if name[-4:] == ".txt": with open(name, "r", encoding="cp932") as f: for line in f: line = line.rstrip() line = re.sub(r"\^g\d\d\d", "", line) line = re.sub(r"\^[nm]", "", line) line = re.sub(r"\^s\d", "", line) line = re.sub(r"\^d\d", "", line) line = re.sub(r"^grpo_[a-z0-9]*", "", line) line = re.sub(r"^grpe", "", line) line = re.sub(r"^grpo", "", line) line = re.sub(r"^99", "", line) line = re.sub(r"\|([^\[]*)\[([^\]]*)\]", r"〈\1〉《\2》", line) forbidden = r"""~`@#$%^&*()_+-=[]\{}|;':,./<>?""" for c in forbidden: if c in line: print(line) exit() if line == "": continue print(line) }}}