Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2012
    Posts
    12

    Smile 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 at 09:37 PM.

  2. #2
    Join Date
    Nov 2012
    Posts
    12

    Default

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

  3. #3
    Join Date
    Nov 2012
    Posts
    12

    Default

    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.

  4. #4
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,893

    Default

    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

  5. #5
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,893

    Default

    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

  6. #6
    Join Date
    Nov 2012
    Posts
    12

    Default

    Hi Aaron,

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

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •