假如文件b.txt内容如下:
yuyuftttftfdhdhdhdhdhdhdhdhdh
fgffgfggfsssseeessfd196.168.002.001hhhhh
查找ip.bat 文件如下:
@echo off
setlocal ENABLEDELAYEDEXPANSION
for /f "tokens=2,3 delims==/." %%i in ('findstr . b.txt') do (
set ybx=%%i.%%j
call 查找ip0.bat %ybx%
)
endlocal
查找ip0.bat 文件如下:
@echo off
setlocal ENABLEDELAYEDEXPANSION
for /L %%i in (0,1,9) do find b.txt "%ybx%.00%%i" && ( set ybx=%ybx%.00%%i& goto ybx)
for /L %%i in (10,1,99) do find b.txt "%ybx%.0%%i" && ( set ybx=%ybx%.0%%i& goto ybx)
for /L %%i in (100,1,999) do find b.txt "%ybx%.%%i" && ( set ybx=%ybx%.%%i& goto ybx)
:ybx
call 查找ip1.bat %ybx%
cls
endlocal
查找ip1.bat 文件如下:
@echo off
setlocal ENABLEDELAYEDEXPANSION
for /L %%i in (0,1,9) do find b.txt "00%%i.%ybx%" && (set ybx=00%%i.%ybx%& goto ybx)
for /L %%i in (10,1,99) do find b.txt "0%%i.%ybx%" && (set ybx=0%%i.%ybx%& goto ybx)
for /L %%i in (100,1,199) do find b.txt "%%i.%ybx%" && (set ybx=%%i.%ybx%& goto ybx)
:ybx
cls
echo %ybx%>c.txt
pause
endlocal
能够查到196.168.002.001保存到c.txt中,可是效率不高,并且196.168.2.1写的还不行.请高手帮忙,谢谢!
yuyuftttftfdhdhdhdhdhdhdhdhdh
fgffgfggfsssseeessfd196.168.002.001hhhhh
查找ip.bat 文件如下:
@echo off
setlocal ENABLEDELAYEDEXPANSION
for /f "tokens=2,3 delims==/." %%i in ('findstr . b.txt') do (
set ybx=%%i.%%j
call 查找ip0.bat %ybx%
)
endlocal
查找ip0.bat 文件如下:
@echo off
setlocal ENABLEDELAYEDEXPANSION
for /L %%i in (0,1,9) do find b.txt "%ybx%.00%%i" && ( set ybx=%ybx%.00%%i& goto ybx)
for /L %%i in (10,1,99) do find b.txt "%ybx%.0%%i" && ( set ybx=%ybx%.0%%i& goto ybx)
for /L %%i in (100,1,999) do find b.txt "%ybx%.%%i" && ( set ybx=%ybx%.%%i& goto ybx)
:ybx
call 查找ip1.bat %ybx%
cls
endlocal
查找ip1.bat 文件如下:
@echo off
setlocal ENABLEDELAYEDEXPANSION
for /L %%i in (0,1,9) do find b.txt "00%%i.%ybx%" && (set ybx=00%%i.%ybx%& goto ybx)
for /L %%i in (10,1,99) do find b.txt "0%%i.%ybx%" && (set ybx=0%%i.%ybx%& goto ybx)
for /L %%i in (100,1,199) do find b.txt "%%i.%ybx%" && (set ybx=%%i.%ybx%& goto ybx)
:ybx
cls
echo %ybx%>c.txt
pause
endlocal
能够查到196.168.002.001保存到c.txt中,可是效率不高,并且196.168.2.1写的还不行.请高手帮忙,谢谢!
