public Path resolveByRule(Path file, Function<String, String> rule) {
        try {
            List<String> newContents = Files.readAllLines(file, StandardCharsets.UTF_8)
                    .stream()
                    .map(content -> resolveByRule(content, rule))
                    .collect(Collectors.toList());
            Path newPath = Paths.get(file.getParent().toString(), file.getFileName() + "$");
            Files.write(newPath, String.join(System.lineSeparator(), newContents).getBytes(StandardCharsets.UTF_8));
            return newPath;
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
Replace template string with special placeholder according to replace function.
@param file  template file with special placeholder
@param rule  placeholder replacement rule
@return new replaced string
inlong-sort/sort-end-to-end-tests/sort-end-to-end-tests-v1.13/src/test/java/org/apache/inlong/sort/tests/utils/PlaceholderResolver.java