将- # 保存了ANSI编码
- /Code="([^"]+)"/ {A = gensub(/^.*Code="([^"]+)".*$/, "\\1", "g", $0)}
- /Name="([^"]+)"/ {B = gensub(/^.*Name="([^"]+)".*$/, "\\1", "g", $0)}
- /Tender="([^"]+)"/ {C = gensub(/^.*Tender="([^"]+)".*$/, "\\1", "g", $0)}
- END {print FILENAME "+" A "+" B "+" C}
复制代码 以ANSI编码格式保存为test.awk
将- @echo off
- @rem 保存为ANSI格式
- set "_gawk.exe=1"
- set "_test.awk=1"
- set "_test.bat=1"
- set "_test.txt=1"
- (for /f "tokens=*" %%a in ('dir/s/b/a-d') do (
- if not defined _%%~nxa gawk -f.\test.awk "%%~fa"
- ))>test.txt
复制代码 以ANSI编码格式保存为test.bat
下载gawk( http://bcn.bathome.net/tool/4.1.0/gawk.exe )后,将gawk.exe、test.awk及test.bat放置到"D:\实例"文件夹中,双击test.bat后得到的test.txt即为你需要的结果 |