下述代码提取文本中出现最多次数的字符,其输出格式为横排:A B C
如何将 空格 替换为 换行符,使其输出格式转变成竖排:
A
B
C- @echo off
- cd /d "e:\data1\000001"
- for %%i in (*.txt) do (
- setlocal enabledelayedexpansion
- for /f "delims=" %%a in (%%i) do (
- for %%b in (%%a) do (
- set/a #%%b+=1
- if !#%%b! gtr !max! (
- set/a max=!#%%b!
- set "#=%%b"
- ) else if !#%%b! equ !max! set "#=!#! %%b"
- )
- )
- echo,!#!>"e:\data2\000001\%%i"
- endlocal
- )
复制代码
|