@echo off
rem 假设文本文件的名称为source.txt
setlocal enabledelayedexpansion
set /a m=2
for /f "tokens=*" %%i in (source.txt) do (
set /a hangn+=1
set /a n+=1
set line=!line! %%i
if !n! equ !m! (
echo !line!>>temp1.txt
set line=
set /a n=0
)
)
set /a t=!hangn!%%!m!
if !t! equ 0 goto find
echo !line!>>temp1.txt
:find
set TarStr=f-MS07-016:928090:0
for /f "tokens=1,2,3,4,5,6,7,8 delims= " %%a in ('findstr "%TarStr%" temp1.txt') do (
set ht=%%h
echo %%g>temp2.txt
)
for /f "tokens=1,2,3 delims=\" %%r in (temp2.txt) do (
echo %%t
)
echo %ht%
del temp1.txt
del temp2.txt
Last edited by HAT on 2007-6-8 at 11:21 AM ]