How to exclude text from compared output

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rob3770
    Journeyman
    • May 2011
    • 18

    How to exclude text from compared output

    We have a nice script which compares our Windows servers services berfore and after implementations.
    Some services are known to us to be safely ignored, i remember i think that certain text can be added to an Exclude list??

    Help!!

    Cheers

    Rob
  • rob3770
    Journeyman
    • May 2011
    • 18

    #2
    Anyone know how to exclude text from being compared?

    Comment

    • Aaron
      Team Scooter
      • Oct 2007
      • 16000

      #3
      Yes. You can define grammar items, mark them as unimportant, and then hide all unimportant differences. We have a kb article and video here:
      http://www.scootersoftware.com/suppo..._unimportantv3

      Let us know if you have any questions.
      Aaron P Scooter Software

      Comment

      • rob3770
        Journeyman
        • May 2011
        • 18

        #4
        Hi, thanks for the link but im running BC 2 and using the command line, the link is for BC 3 and the GUI.

        Cheers

        Rob

        Comment

        • Aaron
          Team Scooter
          • Oct 2007
          • 16000

          #5
          Hello,

          Sorry! I didn't notice which forum you had originally posted in.

          For BC2, you will follow similar steps:
          Use the Tools menu -> Options dialog, Rules section. Edit or define a new rule associated with your file extension.
          In the Importance tab you can define elements as either "Unimportant" or "Strings" (Important).

          You will want to set it up in the graphical interface first, and as the default; that way when you double click and view the files they immediately set what you expect as unimportant.

          If the defaults are setup correctly and the script runs as the same Windows User account, the script will also use the defaults and treat the text as unimportant for rules-based comparison scans, reports, etc.

          I recommend viewing/setting up your files in the graphical interface first. This way you can see if your definitions are marking the text as blue (unimportant) appropriately. Once that is done, it is easier to setup a script that performs the same actions as you have already tested in the graphical interface.
          Aaron P Scooter Software

          Comment

          • rob3770
            Journeyman
            • May 2011
            • 18

            #6
            We don't have the gui version installed only the command line one. Do we need to install it?

            Cheers

            Rob

            Comment

            • Aaron
              Team Scooter
              • Oct 2007
              • 16000

              #7
              Hello,

              You should have an install of BC2 located on your machine. What is your current command line call? Calling BC2.exe should invoke the graphical interface.
              Aaron P Scooter Software

              Comment

              • rob3770
                Journeyman
                • May 2011
                • 18

                #8
                hi,

                The compare command is...
                bc2.exe @C:\sysman\Scripts\Service_Check\commands.txt /silent
                The command file is...
                file-report layout:side-by-side options:display-mismatches output-to:"c:\sysman\scripts\service_check\amalgamated\di ffs\isma-org_Services_Diff.html" output-options:html-color "c:\sysman\scripts\service_check\amalgamated\i sma-org_services_before.txt" "c:\sysman\scripts\service_check\amalgamated\i sma-org_services_after.txt"

                Comment

                • Aaron
                  Team Scooter
                  • Oct 2007
                  • 16000

                  #9
                  Hello,

                  You should be able to boot BC2 by double clicking on the BC2.exe located on your harddrive. If you create a new rule associated with *.txt you can mark specific text as unimportant and test it first in the graphical interface to make sure it is marked as blue. Once it is setup as blue in the interface, the script "ignore-unimportant" report option would then consider the blue text as if it were equal (black). The same as toggling Ignore Unimportant Differences in the toolbar in the graphical interface.

                  How does that work for you?
                  Aaron P Scooter Software

                  Comment

                  • rob3770
                    Journeyman
                    • May 2011
                    • 18

                    #10
                    I still need the service entries displayed if the running state changes, the issue is that BC2 highlights the whole line if it is found in another location in the list.

                    Our support guys are not concerned about that as Windows services can somtimes move in the output list as the system stops and starts them when required.

                    Cheers

                    Rob

                    Comment

                    • Aaron
                      Team Scooter
                      • Oct 2007
                      • 16000

                      #11
                      Hello,

                      So the difference to be ignored is a series of lines in a log file, but the log file lines are in potentially different orders?

                      If you can email us a pair of sample files to [email protected], along with a link back to this forum post for reference, we can take a look at them in more detail.

                      In general, if lines are in different orders on both sides, the method we use to compare them is to Sort them first. If your log files are 1 line apiece, BC3 can use the built in Windows Sort method to sort all of the files. Sorted is one of the default file formats.

                      Another example is presented in this KB article, which goes into detail on using a Custom external conversion solution:
                      http://www.scootersoftware.com/suppo...rnalconversion
                      Aaron P Scooter Software

                      Comment

                      • rob3770
                        Journeyman
                        • May 2011
                        • 18

                        #12
                        Hi,

                        I have clicked within BC2.exe GUI after loading a before and after file- Tools | Edit Current Rules | Importance

                        Added within the String Literals field the service name that i want to mark as Unimportant and clicked OK

                        The script file should use the new rule? It doesn't when tested

                        Please advise as our output is full of lines of text that we have to remember to ignore.

                        Cheers

                        Comment

                        • Aaron
                          Team Scooter
                          • Oct 2007
                          • 16000

                          #13
                          Hello,

                          First, is it being ignored in the graphical interface? If you added the definition to the Strings section (and not the Unimportant section) then it would always be important, which is the opposite of what you want, correct?

                          I believe you want the definition in the Unimportant section, and when you double click your files, it should show up as Blue text. Blue text can then be ignored by toggling on the Ignore Unimportant Differences button in the toolbar.

                          Next, script would need to be run as the same user account as used in the graphical interface. Settings are stored on a per user basis, so if a new user is running the script/command line, they would not have the same settings. If you need to run as a different script user, you should run/setup the graphical interface as them, or run BC2 in a single-directory (all settings shared between all users) mode. It is the same type of install used for USB devices, setup instructions found here:
                          http://www.scootersoftware.com/suppo...removablemedia
                          Aaron P Scooter Software

                          Comment

                          Working...