kwsensen 当前离线
列兵
CUer 当前离线
上尉
gawk "NR<=3" 1.txt >2.txt gawk "NR>3" 1.txt >"%temp%\1.tmp" move /y "%temp%\1.tmp" 1.txt复制代码
TOP
lvsehuaxue 当前离线
六级士官
@Echo off&setlocal enabledelayedexpansion cd.>b.txt for /f "delims=" %%i in (a.txt) do ( set /a n+=1 if !n! leq 10 (echo %%i>>b.txt) if !n!==10 (cd.>a.txt) if !n! gtr 10 (echo %%i>>a.txt) ) pause>nul复制代码
原帖由 yangfengoo 于 2010-10-17 22:20 发表 @echo off type nul >b.txt for /f "tokens=1* delims=:" %%a in ('type a.txt^|findstr /n .* ^&del a.txt') do if %%a leq 10 (echo,%%b>>b.txt) else (echo,%%b>>a.txt)若要3行 改 if %%a leq 10 中10 为3即可
gshccr 当前离线
五级士官
@echo off setlocal enabledelayedexpansion cd.>b.txt for /f "delims=" %%i in (a.txt) do (set /a a+=1 if !a! leq 10 echo %%i>>b.txt) ren a.txt a1.txt&more +10 a1.txt>a.txt&del a1.txt pause复制代码
yangfengoo 当前离线
@echo off type nul >b.txt for /f "tokens=1* delims=:" %%a in ('type a.txt^|findstr /n .* ^&del a.txt') do if %%a leq 10 (echo,%%b>>b.txt) else (echo,%%b>>a.txt)复制代码
评分人数