精确查找- @echo off
- REM 在fileB中查找行which-第三列包含于fileA中-保存到fileC
- if not "%~1"=="" goto print
- pushd "%~dp0"
- set fileA="A.txt"
- set fileB="B.txt"
- set fileC="C.txt"
- setlocal EnableDelayedExpansion
- for /f "usebackq tokens=1 delims=" %%A in (%fileB%) do (
- set /a "n+=1"
- set "#!n!=%%A"
- )
- >%fileC% (
- for /f "tokens=1 delims=:" %%A in ('"%0 %fileB%|findstr /nlxg:%fileA%"') do (
- echo !#%%A!
- )
- )
- endlocal
- popd
- pause
- exit /b
-
- :print
- for /f "usebackq tokens=3" %%a in ("%~1") do (
- echo %%a
- )
- exit /b
复制代码
|