
CODE: [Copy to clipboard]其中 Gawk 是个外部工具,Gawk 下载地址:gawk "{if($0~/[ \t]*ARRIVALS:/)result=$0;if($0~/^Total:.*/)if($2!=0)print result}" hotel.txt
CODE: [Copy to clipboard]@echo off
:: 如果要去掉酒店编号及短横线,请把 echo !str!>>list.txt 换成 echo !str:*-!>>list.txt
set bg=%time%
cd.>list.txt
setlocal enabledelayedexpansion
for /f "tokens=1*" %%i in (test.txt) do (
if /i "%%i"=="ARRIVALS:" set str=%%j
if /i "%%i"=="Total:" if %%j neq 0 echo !str!>>list.txt
)
echo %bg% %time%
pause
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |