How can I ignore some strings when comparing two text files?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lasthero
    Journeyman
    • Nov 2012
    • 19

    How can I ignore some strings when comparing two text files?

    Dear sir,

    There is an example of a text file content:
    ================================================
    Device Name : ACPI Fixed Feature Button
    Manufacturer : (Standard system devices)
    Device Instance ID: ACPI\FixedButton\2&daba3ff&6
    Disabled : No
    Connected : Yes
    Driver Description: ACPI Fixed Feature Button
    Driver Registry Time: 2013/06/28 上午 11:13:38
    ================================================
    If I would like to mask/ignore the string when comparing:
    Driver Registry Time: xxxxxxxxxxxxx

    Because the time difference is not my concerned item so I want to ignore it when comparing them, and for many text files which I need to compare is with all different times.

    How can I do to achieve this?

    My script.txt:
    text-report layout:side-by-side options:display-mismatches output-to:"%3" "%1" "%2"

    The command to compare text files:
    bcompare "@c:\script.txt" "c:\a.log" "c:\b.log" "c:\different.log" /silent

    Thanks,
    Jacky
    Last edited by lasthero; 14-Dec-2015, 10:37 PM.
  • lasthero
    Journeyman
    • Nov 2012
    • 19

    #2
    I've just upgraded my BC3 Standard to BC4 Pro, please help on how to ignore string by BC4 Pro, thanks much!

    Comment

    • lasthero
      Journeyman
      • Nov 2012
      • 19

      #3
      From the BC4 Pro GUI interface I am able to ignore the string by Session Settings -> Importance -> Edit Grammer -> New Add -> Text matching set to "\D+\s\D+\s\D+:\s\d+/\d+/\d+\s\D+\s\d+:\d+:\d" and check "Regular expression" box, and the difference for that string will become from red background to white, which means the string can be ignored, now I need to understand how to do same thing for test script.

      Comment

      • Aaron
        Team Scooter
        • Oct 2007
        • 15997

        #4
        Hello,

        Thanks for the upgrade. BC3 and BC4 could both accomplish this task. We have a helpful KB article and video link here:
        http://www.scootersoftware.com/suppo..._unimportantv3

        Please set this up first in the graphical interface. Once it is working here, we can then set the options as defaults and put them in the script. While testing scripting, also remove /silent until the script is working 100%. Silent will suppress all dialogs, including errors, so it is difficult to troubleshoot while enabled.

        Did you want a grammar that always ignores any line with the text "Driver Registry Time:" present? You could define a Basic grammar element, with Regular Expression enabled, of:
        .*Driver Registry Time.*

        This would match on any line that contains that text. Then, in the Text Compare's Session defaults, define that element name as Unimportant by unchecking it. This is done on the Home screen, in the Saved Sessions list: New folder (BC4), select Text Compare, and in the Importance tab uncheck your new element name.
        Aaron P Scooter Software

        Comment

        • Aaron
          Team Scooter
          • Oct 2007
          • 15997

          #5
          Once set up in the main interface, you need to make these settings the default for future Text Comparisons. This is done on the Home screen, saved sessions list, New folder, Text Compare: Importance tab. Uncheck the grammar element name here to make that element unimportant by default, which is used for new sessions, a rules-based scan, and scripting.
          Aaron P Scooter Software

          Comment

          • lasthero
            Journeyman
            • Nov 2012
            • 19

            #6
            Hi Aaron,

            Thanks, I've solved this problem followed your instruction.

            Thanks,
            Jacky
            Last edited by lasthero; 16-Dec-2015, 02:26 AM.

            Comment

            Working...