需求
文本格式:
如:- 2014-05-13 00:00:00,003 INFO
- 2014-05-13 00:00:00,019 INFO
- sdsaldsdlfkjld
- 2014-05-13 00:01:25,145 ERROR
- 2014-05-13 00:03:00,037 INFO
- sdsaldsdlfkjld
- 2014-05-13 00:03:00,037 ERROR
- 2014-05-13 00:05:37,695 INFO
- 2014-05-13 00:10:10,339 INFO
- sdsaldsdlfkjld
- test
- 1
复制代码 需要显示的结果:- sdsaldsdlfkjld
- 2014-05-13 00:01:25,145 ERROR
- sdsaldsdlfkjld
- 2014-05-13 00:03:00,037 ERROR
- sdsaldsdlfkjld
- test
- 1
-
复制代码 需求:
1.每行以时间开始的并且还很ERROR字符 则输出到新文件
2.每行不是时间开始的直接输出到新文件
注意:非时间开始的行可能有特殊字符如:<a></a>
--------------------------------------------------------------------------------
我写了一个,单个运行可以一起就有问题- @echo off & setlocal EnableDelayedExpansion
-
- for /f "delims=""" %%i in (QQ.txt) do (
- set "str=%%i"
- echo !str! |findstr "^[0-9][0-9][0-9][0-9] ERROR ">>1.txt
- echo !str! |findstr /V "^[0-9][0-9][0-9][0-9]">>1.txt
- )
- pause
复制代码
|