试试- @echo off
- rem 保存为ansi编码
- cd /d "%~dp0"
- for /f "useback tokens=1* delims=," %%a in ("b.csv") do (
- set _%%a=%%b
- )
- (
- echo 城市,团队,小队,分队,奖品,省份,描述
- for /f "useback skip=1 delims=" %%a in ("a.csv") do (
- for /f "delims=," %%b in ("%%a") do (
- (for /f "tokens=1* delims=_=" %%c in ('set _ ^|find "%%b"') do (
- for %%e in (%%d) do (
- set str=%%e
- )
- call echo %%a,%%c,%%str%%
- )) || echo %%a
- )
- )
- ) > "c.csv"
- pause
复制代码
|