@echo off
set "a=aa"
set "aa=a"
(for /f "tokens=1*" %%a in (1.txt) do (
set "str=%%a"
setlocal enabledelayedexpansion
set "str=!str:~1!"
set/a 1/str 2>nul&&set ".=%%a %%b"||for %%i in (%%a %%b)do set ".=!.!!%%i! "
echo,!.!
endlocal
))>$
move $ 1.txt
@echo off
set "a=aa"
set "aa=a"
(for /f "tokens=1*" %%a in (1.txt) do (
set "str=%%a"
setlocal enabledelayedexpansion
set "str=!str:~0,1!"
if "!str!"=="n" (set ".=%%a %%b") else (for %%i in (%%a %%b) do set ".=!.!!%%i! ")
echo,!.!
endlocal
))>new1.txt
pause
DOS下batch文件处理,字符串操作太弱了,工具太少
如果用linux,sed, awk,一两行搞定
你不如装个sed for windows吧
如果你实在要纯DOS batch,得花一点时间帮你写,很久不碰了
建议你用Word来做,超级简单。