Loading ...
Sorry, an error occurred while loading the content.
 

Newbie trying to parse NT Backup Log

Expand Messages
  • Gavin Jolly
    I want a script to search through a text file for certain strings and then copy that line and the two following to a new document. The log file contains non
    Message 1 of 3 , Jul 4, 2000
      I want a script to search through a text file for certain strings and then
      copy that line and the two following to a new document. The log file
      contains non binary(?) characters so I have to use hte filter. That is why
      there are lots of "·" characters.

      There are about 6 drives in the log I want to be listed.

      I have no idea as to the best way to achieve the results I want. Any
      tutorials or text parsing smples will be greatly received. Also total
      working solutions will also be very well received.

      Thanks

      Here is part of the log for backup of the C drive
      _________________________________________
      Tape Name: "Tape created on 7/4/00"·
      ·Backup of "C:"
      Backup set #1 on tape #1
      Backup description: "WHOLE SYSTEM BACKUP - SYSTEM.BAT"·
      ·Backup Method: Normal
      ·
      ·Backup started on 7/4/00 at 22:00:49.·
      ·Directory C:\·
      ·Directory C:\clients·
      ·Directory C:\clients\srvtools·
      ..... [Lines deleted here]
      ·Directory C:\temp\HP004·
      ·Directory C:\temp\HP004\creg·
      ·Directory C:\temp\HP004\pix·
      ·Backup completed on 7/4/00 at 22:01:17.·
      ·Backed up 450 files in 55 directories.·
      ·Processed 25,109,379 bytes in 28 seconds.·
      _____________________________________________

      Part of the log for the Verify of C Drive
      ______________________________________________
      Verify of "C:"
      Backup set #1 on tape #1
      Backup description: "WHOLE SYSTEM BACKUP - SYSTEM.BAT"·
      ·Verify started on 7/5/00 at 2:13:52.·
      ·Directory C:\·
      ·Directory C:\clients·
      ·Directory C:\clients\srvtools·
      ..... [Lines deleted here]
      ·Directory C:\temp\HP004\creg·
      ·Directory C:\temp\HP004\pix·
      ·Verify completed on 7/5/00 at 2:14:16.·
      ·Verified 450 files in 55 directories.·
      ·0 files were different.·
      ·Processed 25,109,379 bytes in 24 seconds.·
      _____________________________________________

      In the new Document I would like the following to be displayed.
      ______________________________________________
      ·Backup started on 7/4/00 at 22:00:49.·
      ·Directory C:\·
      ·Backup completed on 7/4/00 at 22:01:17.·
      ·Backed up 450 files in 55 directories.·
      ·Processed 25,109,379 bytes in 28 seconds.·

      [Other drives will be displayed in here]

      ·Verify started on 7/5/00 at 2:13:52.·
      ·Directory C:\·
      ·Verify completed on 7/5/00 at 2:14:16.·
      ·Verified 450 files in 55 directories.·
      ·0 files were different.·
      ·Processed 25,109,379 bytes in 24 seconds.·
      _______________________________________________

      Gavin Jolly
      Project Engineer/Webmaster
      Ian Smith and Partners Ph: 0064 4 566 8004
      P.O. Box 30535 Fax:0064 4 566 8037
      Lower Hutt EMail:gavin@...
      New Zealand http://www.isp.co.nz/staff/gavin.html

      Please visit our Web Site: http://www.isp.co.nz

      IMPORTANT: The information contained in this Email message may be legally
      privileged and confidential. The information is intended only for the
      recipient named in the Email message. If the reader of this Email message
      is not the intended recipient, any use, copying or distribution of this
      Email message is prohibited. If you have received this Email message in
      error, please notify me immediately (call me on 0800 ISP LINE). Thank you.
    • Grant
      ... This is a pretty simple approach which sets up the pasteboard, finds a chunk of text, selects the wholeline, then copys. This will paste the line into the
      Message 2 of 3 , Jul 5, 2000
        > -----Original Message-----
        > From: Gavin Jolly [mailto:gavin@...]
        > Sent: Wednesday, 5 July 2000 12:17 p.m.
        > To: Ntb-Clips (E-mail)
        > Subject: [Clip] Newbie trying to parse NT Backup Log
        >
        >
        > I want a script to search through a text file for certain strings and then
        > copy that line and the two following to a new document. The log file
        > contains non binary(?) characters so I have to use hte filter. That is why
        > there are lots of "·" characters.
        >
        > There are about 6 drives in the log I want to be listed.
        >
        > I have no idea as to the best way to achieve the results I want. Any
        > tutorials or text parsing smples will be greatly received. Also total
        > working solutions will also be very well received.
        >

        This is a pretty simple approach which sets up the pasteboard, finds a chunk
        of text, selects the wholeline, then copys. This will paste the line into
        the pasteboard document. It then finds the next chunk of text etc.
        It loops untill an error, ie; can't find a new "Backup started on"
        The logfile must be the focused document in notetab.
        Hope this helps.

        H=backUpLog
        ^!Set %DocIndex%=^$GetDocIndex$
        ^!SetNameFormat .txt
        ^!TOOLBAR New Document
        ^!Set %txtIndex%=^$GetDocIndex$
        ^!TOOLBAR Paste Board
        ^!SetPasteboardDivider ^P
        ^!SetDocIndex ^%DocIndex%
        ^!Jump Doc_Start
        :loop
        ^!Find "Backup started on" S
        ^!IfError loopEnd
        ^!Select line
        ^!Toolbar "Copy"
        ^!Jump SELECT_END
        ^!Find "Directory" S
        ^!Select line
        ^!Toolbar "Copy"
        ^!Jump SELECT_END
        ^!Find "Backup completed" S
        ^!Select line
        ^!Toolbar "Copy"
        ^!Jump SELECT_END
        ^!Goto loop
        :loopEnd
        ^!SetDocIndex ^%txtIndex%
        ;******end of clip********

        ps Love The strawbale house
      • Gavin Jolly
        Thanks for your clip. Excellent. I have altered it slightly to select what I want. Eventually I found out that ^!Select 2 will select the current and the
        Message 3 of 3 , Jul 5, 2000
          Thanks for your clip. Excellent.

          I have altered it slightly to select what I want. Eventually I found out
          that "^!Select 2" will select the current and the following line.

          Here is my first full clip I use on a daily basis. It was basically written
          by someone else but I am starting to understand now.

          ^!Set %DocIndex%=^$GetDocIndex$
          ^!SetNameFormat .txt
          ^!TOOLBAR New Document
          ^!Set %txtIndex%=^$GetDocIndex$
          ^!TOOLBAR Paste Board
          ^!SetPasteboardDivider ^P^P
          ^!SetDocIndex ^%DocIndex%
          ^!Jump Doc_Start
          :loop
          ^!Find "Backup started on" S
          ^!IfError loopEnd
          ^!Select 2
          ^!Toolbar "Copy"
          ^!Jump SELECT_END
          ;^!Find "Directory" S
          ;^!Select line
          ;^!Toolbar "Copy"
          ;^!Jump SELECT_END
          ^!Find "Backup completed" S
          ^!Select 3
          ^!Toolbar "Copy"
          ^!Jump SELECT_END
          ^!Goto loop
          :loopEnd

          :loop1
          ^!Find "Verify started on" S
          ^!IfError loop1End
          ^!Select 2
          ^!Toolbar "Copy"
          ^!Jump SELECT_END
          ;^!Find "Directory" S
          ;^!Select line
          ;^!Toolbar "Copy"
          ;^!Jump SELECT_END
          ^!Find "Verify completed" S
          ^!Select 4
          ^!Toolbar "Copy"
          ^!Jump SELECT_END
          ^!Goto loop1
          :loop1End
          ^!SetDocIndex ^%txtIndex%
          ;******end of clip********


          Gavin Jolly
          gavin@...
        Your message has been successfully submitted and would be delivered to recipients shortly.