Batch processing for finding even rows of content

Copy codeThe code is as follows:
@echo off
:: find even rows
set n=0
for /f “delims=” %%i in (test.txt) do set /a n+=1
for /l %%i in (1,2,%n%) do (
findstr /n “.” test.txt|findstr /r “^%%i:”>>tmp.txt
for /f “tokens=1* delims=:” %%i in (tmp.txt) do echo %%j>>end.txt
del tmp.txt
start end.txt

goto :eof

Another solution
: no temporary files are generated and much faster
: in findstr, if you use. *, echo is closed will be displayed in the blank line. “;
:: empty lines will not be printed if
:: code by jm [email protected] 2006-7-29
@echo off
setlocal enabledelayedexpansion
for /f “tokens=1* delims=:” %%i in (‘findstr /n “.” test.txt’) do (
set num=%%i
call :mod
if !mod! equ 0 echo %%j>>result.txt
start result.txt
goto :eof

set /a mod=%num%%%2
goto :eof

A little modification of the previous code can remove the blank lines in the text
@echo off
for /f “tokens=1* delims=:” %%i in (‘findstr /n “.” test.txt’) do (echo %%j>>tmp.txt)
: when the blank line in the text is other unknown code (this happens when you copy it from a web page),
: “echo is off” will be displayed in the blank line. “, the following code is to delete this line
Findstr / V “\ < echo is off. \>” tmp.txt ” result.txt
del /q tmp.txt