Announcement

Collapse
No announcement yet.

How to ignore any line starts with ! char

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to ignore any line starts with ! char

    I am using the latest BC with the following options. What option will help to ignore any line starts with char !
    I greatly appreciate your help.
    C:\BC4\BCompare.exe left-file right-file center-file -silent -force -automerge -ignoreunimportant -mergeoutput=C:\Merged\result-merged-file

  • #2
    Hello,

    First, launch the interface, and in the Text Compare, you can set up unimportant text following this guide:
    http://www.scootersoftware.com/suppo..._unimportantv3

    You probably want to use something like a Delimited Grammar element, of
    ^!
    to
    End of Line
    with Regular Expression enabled.

    Then in the Text Compare and Text Merge session types, set the default Unimportance by unchecking the grammar element name in the default session settings.
    Double check this by launching into the graphical interface for the comparison with:
    bcompare.exe left right center mergetarget
    In the graphical interface, can you see the Unimportance by default? If so, you can then proceed with an automerge.
    Aaron P Scooter Software

    Comment


    • #3
      Aaron, thank you for response. It want to use the script or any command line option that will ignore line starts with ! as I want BC should do it in silent without any GUI. It looks like the three way compare does not allow to use scripts. Would you please help me what should be script file entries for the two-way compare. I greatly appreciate your help. Thank you.

      Could you please help what should be command in the script which will ignore the line which starts with ! char for two files compare and merge. I want the right file content to be merged to the left side file and result in the merged-file. I greatly appreciate your help.
      BCompare.exe @"MyScript.txt Left-File.txt Right-File.txt Merged-File.txt -silent

      Comment


      • #4
        Hello,

        -silent suppresses the interface, so there'd be no way of knowing if everything is configured correctly.

        I suggest building up to the workflow, but using the interface first, configuring options, and then automating it. The File Format and grammar element definition is global, and the Text Compare and Text Merge session settings both need configuration with new global defaults. Then, scripted solutions would also use these settings.

        Text Merge is not a 3-way compare. The Text Compare only supports 2-way comparison. Text Merge is a 3-way merging to an output location. This would use the /automerge command line, but I would recommend using the graphical interface first to see if the output's merge logic is working as you expect. Automerge is simply auto-generating this output and saving to a file without preview or user input.
        Aaron P Scooter Software

        Comment


        • #5
          Aaron,
          Thank you for you detailed explanation and quick respond. What I want is very simple. Please give me the best and easy solution. I have three files. I need to compare and merge them and make one-merged-file. I use the -mergeoutput option to save the merged file. I want ignore any line starts with char ! (that's all). You have mentioned that the scripting is not possible using three-way compare & merge. What options that I should choose to ignore ! lines using the GUI?
          I can also do two files compare and merge them. Then, I can compare merged file and the third and create the final merged file. So, in the two way compare & merge what should I give to ignore the lines start with ! in the script file. Thank you for your help

          Comment


          • #6
            Hello,

            Is one of the three files a common ancestor of the other two? If so, the Text Merge session would work well and the ancestor should be the third parameter (center pane).

            If none of the files is a common ancestor, you could still use the Text Merge session type, but how it auto-determines if to take from Left or Right logically assumes the Center is a common Ancestor of either, so you'll need to more carefully review the output for how it defines a Conflict or if it auto-assumed Left or Right changes.

            The Text Merge is also capable of no-center merging, with a Left, Right, and Output only defined. This would be useful for your Two Pass method.

            Launch BC4 and open a new, blank Text Merge session. I would suggest first loading the files and not ignoring ! comment lines initially. But once the Text Merge is loaded, you can define a new Grammar Element to match on that concept. Follow this guide, video to help define the grammar element:
            http://www.scootersoftware.com/suppo..._unimportantv3

            It sounds like a Grammar Element, Delimited type, from:
            ^!
            to
            End of Line enabled
            Regular Expression enable

            would match on this idea. You can then uncheck this Grammar Element Name in the Text Merge's Session Settings, Importance tab, and the bottom dropdown update from Use only for this view to Also update session defaults.
            Aaron P Scooter Software

            Comment

            Working...
            X