No announcement yet.

Ignoring the first line of certain file types

  • Filter
  • Time
  • Show
Clear All
new posts

  • Ignoring the first line of certain file types

    I am trying to compare two projects where the first line of every .aspx file is different. Is it possible to configure Beyond Compare to ignore the difference or ignore the first line completely? An example of the differences is below.

    <%@ Page Language="C#" Inherits="Foo.Bar" Codebehind="Bar.aspx.cs" %>
    <%@ Page Language="C#" Inherits="Foo.Bar" CodeFile="Bar.aspx.cs" %>
    Last edited by philw; 05-May-2009, 11:37 AM.

  • #2
    Go to Tools/File Formats and add a new element (i. e. ASPX_1st).

    General/Mask: *.aspx
    Element name: FirstLine
    Category: Lines
    Check "or line 1"

    If you wish to use this file format only for comparing special projects and not for all aspx-files you should uncheck this file format in Tools/File Formats.

    Then create a folder compare session for your special projects and go to Session/Session settings/Misc/Enabled file formats and check ASPX_1st there.
    Don't change the selection "Use for this view only" on the bottom.


    • #3
      I apreciate the quick reply. I created a new ASPX File Format with your suggested grammer; however, It has not resolved my issue. When I compare the two directories I still see .aspx files that are identical, with the exception of the first line. I was concerned that default HTML File Format might be causing an issue because it contains *.aspx but I see the same behavior when HTML is unchecked. Is there anything else I should be looking for?


      • #4
        When you open the pair of Text files, is it using your File Format automatically? It should use the topmost associated with *.aspx in the Tools -> File Formats dialog. Define it as category Lines: or line 1 and next 0 lines?

        Then in Session Settings, uncheck "FirstLine" in the Importance tab?

        Also, are you using the latest release of BC3?
        Aaron P Scooter Software


        • #5
          I am using Version 3.1.2 (build 10221).

          The ASPX_1st format/mask is the top most entry on the File Formats screen. Originally I had configured the Grammar Item as follows:

          Element Name: FirstLine
          Category: Lines
          or line 1: Checked
          and next: 1 lines
          This element is case sensitive: Checked

          I have tried changing it to use and next 0 lines but that has not resolved the issue. I have attached a screenshot of my Grammar Item in case that helps.

          I do not see an "Importance" tab on the "Folder Compare - Session Settings" page. Where is it located?

          Thanks again
          Last edited by philw; 05-May-2009, 04:41 PM.


          • #6
            Your screenshot looks ok, so it should be the importance setting as Aaron mentioned.
            You can find it on the "Text Compare - Session Settings" page and also on the "Home" page/Edit session defaults/Text Compare.
            Last edited by Lutz; 06-May-2009, 05:22 AM. Reason: screenshot added


            • #7
              I added the FirstLine grammar to the Text Compare importance screen; however, it has not resolved my issue. Do you have any other suggestions?


              • #8
                You have to uncheck FirstLine.


                • #9
                  Thank you. Unchecking the option on the Importance tab resulted in text comparisons working as desired. Is there a way I can apply this change to the Folder Comparison so that when I attempt to merge two projects, aspx pages that only differ on the first line do not show up?


                  • #10
                    You should create a Folder Compare Session as I described in my first reply (you may leave the base folders empty).
                    • Open the session with your projects and open a text comparision of two aspx-files.
                    • Uncheck FirstLine importance and select one of the "Use for ... parent session" settings.
                    • Close the text comparision.
                    • Select View/Show Differences and Ignore Unimportant Differences.
                    • Folder Compare/Session Settings/Specs:
                      You may clear the base folders.
                    • Folder Compare/Session Settings/Comparision:
                      Check Compare contents/Rules-based comparision.
                    • Folder Compare/Session Settings/Handling:
                      Check Folder handling as desired.
                    • Folder Compare/Session Settings/Misc:
                      Check ASPX_1st in Enabled file formats.
                    • Save the folder compare session.


                    • #11
                      You can do as Lutz describes. You can also uncheck it as a default for ALL text compares.

                      Go to the Home screen
                      expand the Edit Session Defaults folder, select Text Compare
                      go to the Importance tab and uncheck it here.

                      This will save it as the session default for all Text Compares.
                      Aaron P Scooter Software


                      • #12
                        Hi All,

                        I'm trying to resolve the same issue but i've one problem..

                        I've applied the rule to ignore 1st line for extensions aspx;ascx.

                        However when i perform binary comparison, it shows me file mismatch icon & when i double click & open it in view mode, icon changes to "almost equal" (~~).

                        It seems that rule is applied only when i open the file in view mode.

                        How can i include this rule in folder scan so that all the files display this "almost equal" sign after the scan itself , so that i dont have to manually open each file in view mode.

                        any help is highly appreciated. Thanks .


                        • #13
                          Edit the Session Settings for your folder compare and enable the Compare contents section using a Rules-based comparison instead of a Binary comparison. If you leave Quick tests enabled, be sure to check the option to Override quick test results.
                          BC v4.0.7 build 19761


                          • #14

                            A Binary compare runs a binary comparison, comparing each and every bit of the file (not just the text.
                            A CRC compare runs a CRC comparison, scanning the entire file and then generating a unique code which is compared.
                            A Rules-based compare runs our file view's comparison, as if you opened and viewed the file using the default file compare and then return the results of the comparison.

                            To pick which to use automatically, go to the Folder Compare's Session menu -> Session Settings dialog. Select the Importance tab, and make sure that the Quick tests: Compare timestamps and Compare size are enabled, and that Compare Contents: Rules-based is enabled, and that Override Quick Test results is enabled.

                            As a side note, you can show/hide "Almost Equal" files with the '~' by toggling on or off the Ignore Unimportant Differences in the toolbar (of the Folder Compare or Text Compare).
                            Aaron P Scooter Software


                            • #15
                              Thanks a lot guys. I'm able to resolve the issue