回复 6# 438050057
以下版本可在批处中直接过滤重复字符串,但不区分大小写- @echo off &(for /f "delims=" %%F in ('dir /b/a-d *.h') do for /f tokens^=2^delims^=^" %%v in (
- 'findstr /irc:"#define .*\".*\"" "%%F" ') do if not defined _#%%v (
- set "_#%%v=1" &set "v=%%v" &setlocal enabledelayedexpansion &if "!v:~,1!"=="*" echo,%%v&endlocal))>all.txt
- type "all.txt"&pause&exit/b
复制代码 如须区分大小写,可用以下版本,但须从本坛第三方下载 gawk.exe v4.1.3版本,落地即用,与批处脚本和 *.h 文件同目录(http://bcn.bathome.net/s/tool/index.html?key=gawk)- @echo off &(for /f "delims=" %%F in ('dir /b/a-d *.h') do for /f tokens^=2^delims^=^" %%v in (
- 'findstr /irc:"#define .*\".*\"" "%%F" ') do (
- set "v=%%v" &setlocal enabledelayedexpansion &if "!v:~,1!"=="*" echo,%%v&endlocal))>0.0
- endlocal &gawk "!a[$0]++" "0.0">all.txt
- del /q "0.0" &type "all.txt" &pause &exit/b
复制代码
|