Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Extracting a string from logfile  (Read 2067 times)

0 Members and 1 Guest are viewing this topic.

mblm07

  • Guest
Extracting a string from logfile
« on: March 27, 2009, 09:28:46 AM »
Hi Folks,

From the following logfile I am trying to extract "NetWorker savegroup: (notice) index completed" to a variable - I have tried lots of variations using find & findstr but have had no success.  Can anybody point me in the right direction to achieve this.

Mar 27 14:36:18 moses: NetWorker savegroup: (notice) index completed, Total 1 client(s), 1 Succeeded. Please see group completion details for more information.
Mar 27 14:36:18 moses: Succeeded: moses
Mar 27 14:36:18 moses: saveset moses:C:\DELL: percentage of inactive files by count: 50.00, by space: 39.61
Mar 27 14:36:18 moses: Start time:   Fri Mar 27 14:35:51 2009
Mar 27 14:36:18 moses: End time:     Fri Mar 27 14:36:18 2009
Mar 27 14:36:18 moses: --- Successful Save Sets --- Mar 27 14:36:18 moses: * moses:Probe savefs moses: succeeded.
Mar 27 14:36:18 moses:   moses: C:\DELL                    level=full,    401 KB 00:00:04     16 files

Many Thanks,
Matt.

macdad-



    Expert

    Thanked: 40
    Re: Extracting a string from logfile
    « Reply #1 on: March 27, 2009, 11:33:19 AM »
    you could try this script:
    Code: [Select]
    @echo off
    for /f "tokens=*" %%a in ('findstr "NetWorker savegroup: (notice) index completed" logfile.txt') do set returnstring=%%a
    echo %returnstring%
    pause

    Hope this Helps
    ,Nick(macdad-)
    If you dont know DOS, you dont know Windows...

    Thats why Bill Gates created the Windows NT Family.