- @echo off
- setlocal enabledelayedexpansion
- set n=1000
- (for /f "tokens=1,* delims=:" %%x in ('findstr /n .* a.txt') do (
- set "line=%%y"
- if defined line (
- if "!line:e name=!" equ "!line!" (
- if "!line:eName=!" equ "!line!" (
- echo,%%y
- ) else (
- echo ^<eName^>!n!^</eName^>
- set /a n+=1
- )
- ) else (
- echo ^<e name="!n!"^>
- REM set /a n+=1
- )
- ) else (
- echo,
- )
- ))>b.txt
复制代码
|