诸如:
TX13P,,,,,,,,A7,,,,,,,,,,,Serdes_Driver,,,,,,SIG,,,,,,,,,,,,,,,,----
GND,,,,,,,,,,A8,,,,,,,,,,,----,,,,,,,,,,,,,,,GND,,,,,,,,,,,,,,,,----
TDI,,,,,,,,,,A9,,,,,,,,,,,CMOS,,,,,,,,,,,,,,,TST,,,,,,,,,,,,,,,,1.8V
将多个,变成1个,
@echo off echo 【提示】代码用“畱”作为段落标识符,如果文中有该字,应改为文中没有的符号! for /f %%w in (test.txt) do call set all=%%all%%畱%%w :continue for /f "delims=畱 tokens=1,*" %%p in ("%all%") do ( set line=%%p set all=%%q ) if "%line%"=="" (call :over) else (call :lineDispose) :lineDispose :continueDispose for /f "delims=, tokens=1,*" %%i in ("%line%") do ( call set newLine=%%newLine%%,%%i set line=%%j ) if "%line%"=="" (echo %newLine:~1%&set newLine=&goto continue) else (goto continueDispose) pause>nul :over echo 工作已经完成,按任意键退出。&pause>nul&exit