|
|
发表于 2011-9-23 12:11:30
|
显示全部楼层
本帖最后由 hfg1977 于 2011-9-23 12:13 编辑
水平有限,只能分两次提取, test code 如下:
- sed -n "/\<Loss\>/ s/.*[ ]\([0-9]\{1,\}\.[0-9]\{1,\}\%%([0-9]\+v)\).*[ ]\([0-9]\{1,\}\.[0-9]\{1,\}\).*/\t\1\t\2/p" a.txt
- sed -n "/\<LOSS\>/ s/.*[ ]\([0-9]\{1,\}\.[0-9]\{1,\}\).*/\t\t\t\1/p" a.txt
复制代码 完整过程如下: 一次完成全部工作
- @echo off
- echo.filename Tu L >b.txt
- for /f "tokens=* delims=" %%a in ('dir /a-d/s/b "*.txt"') do (
- sed -n "/\<Loss\>/ s/.*[ ]\([0-9]\{1,\}\.[0-9]\{1,\}\%%([0-9]\+v)\).*[ ]\([0-9]\{1,\}\.[0-9]\{1,\}\).*/%%~nxa\t\1\t\2/p" "%%~a"
- sed -n "/\<LOSS\>/ s/.*[ ]\([0-9]\{1,\}\.[0-9]\{1,\}\).*/%%~nxa\t\t\t\1/p" "%%~a"
- )>>b.txt
- :end
复制代码 |
|