- @echo off&setlocal enabledelayedexpansion
- for /f "skip=1 tokens=1,2,3 delims= " %%a in (test.xls) do (
- if not defined flag >test.xls echo job money
- set flag=1
- if "%%b"=="total" (
- >>test.xls echo %%a:%%b !total:~0,-2!.!total:~-2!
- set total=0) else (
- >>test.xls echo %%b %%c
- call :count %%c
- )
- )
- pause
- set flag=&set total=&set money=
- exit
-
- :count
- set money=%1
- if "%money:~-3,1%"=="." (set money=%money:.=%) else (
- if "%money:~-2,1%"=="." (set money=%money:.=%0) else (
- set money=%money%00
- )
- )
- set /a total=%total%+%money%
- goto :eof
复制代码 注:delims是以TAB来分开提取的,echo句中也是TAB来分开的
[ 本帖最后由 shqf 于 2008-12-14 10:36 编辑 ] |