ãç¶ã ãtailã³ãã³ãã®ä½æ
ååæ¸ãã2ã¤ã®æ¹æ³ã§æ¸ãã tail ã³ãã³ãã®åºå¹¹é¨åã示ãã
(1) ä¸éãã¡ã¤ã«æ¹å¼
set I=-%LINE% set J=0 for /f "delims=" %%A in ('more %1') do ( ãset /a J+=1, I+=1 ãecho.%%A>%TEMPFILE% ãcall set /p SAVE%%J%%=< %TEMPFILE% ãcall set "SAVE%%I%%=" ) set /a I+=1 if %I% leq 0 set I=1 setlocal enabledelayedexpansion for /l %%K in (%I%,1,%J%) do echo.!SAVE%%K! del /f %TEMPFILE% 2>NUL goto :eof
(2) for (%%) æ¹å¼
set I=-%LINE% set J=0 for /f "delims=" %%A in ('more %1') do ( ãset /a J+=1, I+=1 ãfor /f "delims=" %%B in ('echo SAVE%%J%%') do set %%B=%%A ãcall set "SAVE%%I%%=" ) set /a I+=1 if %I% leq 0 set I=1 setlocal enabledelayedexpansion for /l %%K in (%I%,1,%J%) do echo.!SAVE%%K! goto :eof
ããã¨ã(3) [ç¶]tailã³ãã³ãã®ä½æã§æ¸ãããmore + ã使ã£ãæ¹å¼ã¨ã§å¦çæéãæ¯ã¹ã¦ã¿ãããã¹ãã§ã¯ 1000è¡ãç´32KB ã®ãã¡ã¤ã«ã«å¯¾ãã¦ãtail -10 ãè¡ã£ããçµæã¯ã
(1) 25 ç§
(2) 99 ç§
(3) 1 ç§
ã§ããã(3) ãæ©ãã®ã¯å½ç¶ã¨ãã¦ã(2)ãé
ãã®ã¯ãµãã·ã§ã«èµ·åã«æéãæãã£ã¦ããããã¨æããããæ¤è¨¼ã®ããã«ã
for /l %I in (1,1,1000) do @cmd /c "@rem"
ã¨ã
for /l %I in (1,1,1000) do for /f %J in ('rem') do @echo.
ã®æéãè¨ã£ã¦ã¿ãã¨ãããããã102ç§ã75ç§ã§ããã(2) ã®çµæã¨ãèãåãããã¨ãfor /f (' ') ã«ãããµãã·ã§ã«èµ·åã¯ãæ示çã« cmd ãèµ·åããããã¯å¹çããåºæ¥ã¦ããããã ã
çµè«ã¨ãã¦ã¯ããããâãã¤ãå
¥åã«ã対å¿ââä¸éãã¡ã¤ã«ã使ããªãâã¨ããå©ç¹ãããã¨ãã¦ã(2)ã¯é
ãããããªãã©ã³ãã§ãã¡ã¤ã«ãä¸ããæã¯(3)ã§ãããã§ãªãå ´åã¯(1)ã®æ¹å¼ããããã使ãããã«ããã®ããããã¨æãã