- @echo off
- SETLOCAL EnablEdElayEdExpansion
- pushd "%~dp0"
- if exist wellhead_all.txt ren wellhead_all.txt wellhead_all.bak
- for %%i in ( wellhead_*.txt ) do (
- set file1=%%~i
- echo %%~i 处理中…
- echo.
- for /f "tokens=1*" %%a in (!file1!) do if not "%%a"=="" set %%a=1
- (for /f "tokens=1*" %%A in (wellhead_all.bak) do if defined %%A echo %%A %%B) > new_%%~i
- echo %%~i 处理完成
- echo.
- )
- if exist wellhead_all.bak ren wellhead_all.bak wellhead_all.txt
- pause
复制代码 请自行替换 %%A %%B之间的空格为TAB。 |