none
findstr can't read ntbackup log files

    Question

  • Hi,

    I've been banging my head against this problem for a few hours now...

    All I want to do is process some log files being created by ntbackup on several servers.

    I've got most of the little elements in place, but the main one, grabbing lines with keywords from the log files, is just refusing to work.

    It doesn't seem to matter what size the log file is - A couple of lines when a tape fails to load, to a few Mb when doing a full log, findstr refuses to find anything that I ask it to look for in the log file.

    A while ago, I gave up and downloaded UnixUtils to use the grep - that does the same thing.

    If I delete all bar one or two basic lines from the file it doesn't find anything.

    If I rename the file, it doesn't find anything.

    If I create a new file and copy some or all of the text from a non-working log file into it, both findstr & grep find the search terms.

    If I do 'type original.log > new.log' and then use the same findstr command on the new file - They find the terms

    (Strangely, although it contains all of the original text, 'new.log' is exactly half the size of original.log (I've tried it with several different sized logs & the 'type'd version is always exactly half the bytes))

    I'm suspecting there's something very basic I should know about the ntbackup log file format - Can anyone tell me what's making findstr & grep bomb-out please?

    Many thanks,

    Rufus

    Thursday, June 20, 2013 10:16 PM

Answers

  • Findstr only works for ascii files. I think the logfiles for ntbackup are unicode, also supported by the "half size" thing: unicode uses 2 bytes for each character, where ascii uses only one.

    If you use notepad, you can simply open the file and select File - Save as and select ANSI from the dropdownbox.


    MCP/MCSA/MCTS/MCITP

    Friday, June 28, 2013 9:00 AM

All replies

  • Findstr only works for ascii files. I think the logfiles for ntbackup are unicode, also supported by the "half size" thing: unicode uses 2 bytes for each character, where ascii uses only one.

    If you use notepad, you can simply open the file and select File - Save as and select ANSI from the dropdownbox.


    MCP/MCSA/MCTS/MCITP

    Friday, June 28, 2013 9:00 AM
  • Many thanks for the answer SenneVL - Piping type to it does the trick :)
    Tuesday, July 02, 2013 2:01 AM