@echo off
goto begin
Parameter 1: Text file name
Parameter 2: Number of characters in the line to be displayed (can be saved)
For example, the line with 4 characters to be printed:
4
Or drag and drop the file you want to process onto the script file and follow the prompts.
Very efficient
:begin
setlocal ENABLEDELAYEDEXPANSION
set var=%2
if "%var%" == "" set /p var=Enter the number of characters of the line to be displayed:
for /l %%i in (1,1,%var%) do set str=!str!.
findstr /x %str% %1
pause>nul
goto :eof
@echo off
:: Shows a line of text with only 4 characters
:: There are only pure letters, no spaces, no empty lines
:: Because it is full-text analysis, it is inefficient
:: code by jm 2006-8-14
for /f %%i in () do (
set str=%%i
set var=%%i
call :loop
set num=0
)
pause
goto :eof
:loop
set var=%var:~0,-1%&& set /a num+=1
if not "%var%"=="" goto loop
if %num% equ 4 echo %str%
goto :eof
@echo off
:: The efficiency is high
:: Suitable for spaces in rows
:: If you do not insert characters and only judge the 5th bit character situation, an error will occur
:: code by 3742668
setlocal ENABLEDELAYEDEXPANSION
for /f "delims=" %%i in () do (
set str=b%%ie
if not "!str:~5,1!" == "" if "!str:~6,1!" == "" echo. %%i
)
pause
goto :eof