优化一下自己楼上的代码:- @echo off
- setlocal enabledelayedexpansion
- set n=-1
- for /f "tokens=1,2 delims=," %%i in (a.txt) do (
- set /a n+=1
- set /a m=n/3
- if !m! equ 0 (
- if %%j gtr 4 set n=-1
- ) else if !m! equ 1 (
- if %%j lss 7 (
- if %%j gtr 4 (
- set n=-1
- ) else (
- if !n! equ 3 (
- set n=2
- ) else (
- set n=0
- )
- )
- )
- ) else (
- if %%j gtr -7 (
- if %%j gtr 4 (
- set /a n-=7
- ) else (
- set /a n-=6
- )
- ) else (
- if !n! equ 8 (
- echo,%%i,%%j
- set n=2
- )
- )
- )
- )
- pause
复制代码
|