从下到上批量阅读

时间:2014-08-14 16:14:38

标签: batch-file

您好我有一个由3个快照组成的日志文件。我想读取文件,以便只测试最后一个快照。在快照中,我将逐行查看某个字符串。如果找不到该字符串,它将写入日志文件。日志文件的快照数量不固定。有没有办法只捕获这部分日志?

=====  18:48:21 GMT      14:48:21 local  ===== Server:MAP24329-BBCP ===========
1796    Th:Pseudo   Idle    -   -   -   -
8572    Th:DynamicConfig    Idle    -   -   -   -
11828   ??? Idle    SystemServerConnectWithCAMNamespace -   -    63962
8072    ??? Idle    SystemServerConnectWithCAMNamespace -   -    63962
5440    ??? Idle    SystemServerConnectWithCAMNamespace -   -    63962
10180   ??? Idle    SystemServerConnectWithCAMNamespace -   -    63962
11280   ??? Idle    SystemServerConnectWithCAMNamespace -   -    63963
6304    ??? Idle    SystemServerConnectWithCAMNamespace -   -    63962
10872   ??? Idle    SystemServerConnectWithCAMNamespace -   -    63963
5128    ??? Idle    SystemServerConnectWithCAMNamespace -   -    63963
9276    ??? Idle    SystemServerConnectWithCAMNamespace -   -    63962
12176   ??? Idle    SystemServerConnectWithCAMNamespace -   -    63962
9624    ??? Idle    SystemServerConnectWithCAMNamespace -   -    63962
9472    ??? Idle    SystemServerConnectWithCAMNamespace -   -    63962
8008    AD\Kaif, Rizwan Idle    -   -   -   -
11748   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
5828    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
11440   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
7380    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
7972    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
14292   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
12136   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
6768    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
10984   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
5808    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
12904   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
7180    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
10436   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
12792   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
7572    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
9616    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
3544    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
6504    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
8012    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
6876    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
13040   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
11572   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
5932    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
5780    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
12712   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
9632    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
14304   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
2964    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
5036    AD\System_ES_COG_RMT_D  Wait:IXCur(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client) -   Client  (R)0(IX)1(W)0   -
12452   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
13048   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
6452    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
8116    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
5692    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
11308   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
6928    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
11388   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
8764    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
12540   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
1776    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
8420    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
7568    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
3984    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
9008    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
6480    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
8828    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
12364   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
9768    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
10648   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
7488    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
7128    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
12320   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
13224   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
13132   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
9100    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
5136    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
5992    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
13760   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
6516    AD\System_ES_COG_RMT_D  Run:R(}ElementAttributes_CCIS_Org_Unit_Financial)-(Cube)    ProcessExecuteEx    Cube    (R)52(IX)0(W)0     721
7476    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
10008   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
12244   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
10284   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
1176    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
12036   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
11948   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
5972    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
5228    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
14268   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
2396    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
12824   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
14248   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
9332    AD\Mayekar, Aditee  Idle    -   -   -   -
5544    AD\Velusamy, Kalaiyarasi    Idle    -   -   -   -
8952    AD\Velusamy, Kalaiyarasi    Idle    -   -   -   -
6460    AD\Velusamy, Kalaiyarasi    Idle    -   -   -   -

=====  18:49:11 GMT      14:49:11 local  ===== Server:MAP24329-BBCP ===========
1796    Th:Pseudo   Idle    -   -   -   -
8572    Th:DynamicConfig    Idle    -   -   -   -
11828   ??? Idle    SystemServerConnectWithCAMNamespace -   -    64012
8072    ??? Idle    SystemServerConnectWithCAMNamespace -   -    64012
5440    ??? Idle    SystemServerConnectWithCAMNamespace -   -    64012
10180   ??? Idle    SystemServerConnectWithCAMNamespace -   -    64012
11280   ??? Idle    SystemServerConnectWithCAMNamespace -   -    64013
6304    ??? Idle    SystemServerConnectWithCAMNamespace -   -    64012
10872   ??? Idle    SystemServerConnectWithCAMNamespace -   -    64013
5128    ??? Idle    SystemServerConnectWithCAMNamespace -   -    64013
9276    ??? Idle    SystemServerConnectWithCAMNamespace -   -    64012
12176   ??? Idle    SystemServerConnectWithCAMNamespace -   -    64012
9624    ??? Idle    SystemServerConnectWithCAMNamespace -   -    64012
9472    ??? Idle    SystemServerConnectWithCAMNamespace -   -    64012
8008    AD\Kaif, Rizwan Idle    -   -   -   -
11748   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
5828    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
11440   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
7380    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
7972    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
14292   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
12136   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
6768    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
10984   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
5808    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
12904   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
7180    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
10436   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
12792   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
7572    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
9616    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
3544    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
6504    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
8012    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
6876    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
13040   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
11572   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
5932    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
5780    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
12712   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
9632    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
14304   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
2964    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
5036    AD\System_ES_COG_RMT_D  Wait:IXCur(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client) -   Client  (R)0(IX)1(W)0   -
12452   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
13048   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
6452    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
8116    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
5692    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
11308   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
6928    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
11388   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
8764    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
12540   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
1776    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
8420    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
7568    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
3984    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
9008    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
6480    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
8828    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
12364   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
9768    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
10648   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
7488    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
7128    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
12320   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
13224   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
13132   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
9100    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
5136    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
5992    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
13760   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
6516    AD\System_ES_COG_RMT_D  Run:R(}ElementAttributes_Customer_Profitability_Deposit_Calc_m)-(Cube)  ProcessExecuteEx    Cube    (R)52(IX)0(W)0     771
7476    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
10008   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
12244   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
10284   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
1176    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
12036   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
11948   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
5972    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
5228    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
14268   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
2396    AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
12824   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
14248   AD\System_ES_COG_RMT_D  Run:R(CAMID("AD:u:cd3f3b22b5867f409eb5487c2d0970d4"))-(Client)  -   Client  -   -
9332    AD\Mayekar, Aditee  Idle    -   -   -   -
5544    AD\Velusamy, Kalaiyarasi    Idle    -   -   -   -
8952    AD\Velusamy, Kalaiyarasi    Idle    -   -   -   -
6460    AD\Velusamy, Kalaiyarasi    Idle    -   -   -   -

=====  18:50:01 GMT      14:50:01 local  ===== Server:MAP24329-BBCP ===========
1796    Th:Pseudo   Idle    -   -   -   -
8572    Th:DynamicConfig    Idle    -   -   -   -
11828   ??? Idle    SystemServerConnectWithCAMNamespace -   -    64062
8072    ??? Idle    SystemServerConnectWithCAMNamespace -   -    64062
5440    ??? Idle    SystemServerConnectWithCAMNamespace -   -    64062
10180   ??? Idle    SystemServerConnectWithCAMNamespace -   -    64062
11280   ??? Idle    SystemServerConnectWithCAMNamespace -   -    64063
6304    ??? Idle    SystemServerConnectWithCAMNamespace -   -    64062
10872   ??? Idle    SystemServerConnectWithCAMNamespace -   -    64063
5128    ??? Idle    SystemServerConnectWithCAMNamespace -   -    64063
9276    ??? Idle    SystemServerConnectWithCAMNamespace -   -    64062
12176   ??? Idle    SystemServerConnectWithCAMNamespace -   -    64062
9624    ??? Idle    SystemServerConnectWithCAMNamespace -   -    64062
9472    ??? Idle    SystemServerConnectWithCAMNamespace -   -    64062
8008    AD\Kaif, Rizwan Idle    -   -   -   -
9332    AD\Mayekar, Aditee  Idle    -   -   -   -
5544    AD\Velusamy, Kalaiyarasi    Idle    -   -   -   -
8952    AD\Velusamy, Kalaiyarasi    Idle    -   -   -   -
6460    AD\Velusamy, Kalaiyarasi    Idle    -   -   -   -

2 个答案:

答案 0 :(得分:2)

for /f "tokens=1 delims=[]" %%i in ('find /n "====" t.txt') do set /a last=%%i-1
more +%last% t.txt

第一行:搜索====(快照的开头)。变量%last%设置为每个找到的亚麻(/n),覆盖它的先前值。所以你得到了最后一次出现。

使用more键入文件,跳过第一个%last%行(因此set /a last=%%i-1中的“-1”)。

答案 1 :(得分:0)

读取搜索每个快照开头的文件以及包含所需术语的行。对于每一行,如果是快照,请将搜索标记为失败。如果它不是快照,则它是匹配的行并将该行标记为已找到。

将搜索字词调整为您要查找的内容。

@echo off
    setlocal enableextensions disabledelayedexpansion

    set "searchTerm=Profitability"

    set "found="
    for /f %%a in ('findstr /r /c:"^===== " /c:"%searchTerm%" "data.txt"'
    ) do if "%%a"=="=====" ( set "found=" ) else ( set "found=1" )

    if defined found (
        echo Search term found in last snapshot
    ) else (
        echo Search term NOT FOUND in last snapshot
    )