const fs = require("fs");

fs.readFile(__dirname + "/aa.txt", "utf8", (err, data) => {
  if (err) return;

  const content = data
    .replace(/(\d+)[、.](?=\s*)/g, "$1、 ")
    .replace(/([A-D])[.、](?=\s*)/g, "$1. ")
    .replace(/\r?\n([B-D]\.)/g, "\t$1");

  fs.writeFile(__dirname + "/new.txt", content, "utf8", (err) => {
    if (err) return;
  });
});
