我的iis日志文件包含如下内容:
Line 4780: 2014-12-01 00:58:25 10.211.200.33 - 10.211.55.6 80 POST /localhost/logon.aspx username=michael&CAMUsername=GROUP1&CAMPassword=@SzbRERF&CAMNamespace=zCORP
Line 4781: 2014-12-01 00:58:25 10.211.200.33 - 10.211.55.6 80 POST /localhost/logon.aspx username=john&CAMUsername=GROUP3&CAMPassword=@SzbRERF&CAMNamespace=zCORP
Line 4782: 2014-12-01 00:58:27 10.211.200.33 - 10.211.55.6 80 POST /localhost/logon.aspx username=daisy&CAMUsername=GROUP1&CAMPassword=@SzbRERF&CAMNamespace=zCORP
我要提取该文件。我将得到这样的文本输出:
michael GROUP1
john GROUP3
daisy GROUP1
任何人都可以帮我这样做吗?
答案 0 :(得分:1)
@echo off
setlocal
set "iis_log=c:\iis.log"
for /f "useback tokens=2,4 delims==&" %%a in ("%iis_log%") do (
echo %%a %%b
)
endlocal