Announcement

Collapse
No announcement yet.

Grammer Item help with delimited lines

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

  • Grammer Item help with delimited lines

    Hello, I have just started using beyond compare. I am using it to compare a set of files in 2 different folders. It is working well but I am trying to refine what is considered an un-important difference, using a grammer item. I can flag an entire line as unimportant, but would like to be able to focus on a specific data element in a specific line. For example, in the line below, I want to ignore any difference in the last data element (the date), but alert me on any differences in the other elements. In laymans terms, the rule I am looking for is this: "For lines starting with 'BAK', use a delimiter of "|" and ignore difference in position 9". My regex skills are a little weak. Is this possible with a grammer item?

    BAK|00|AC|A4094-2|20140130||10|NATIONAL|0001391143|20140530

  • #2
    Hello,

    Grammars are not conditional, so creating If/Then would be impossible. The RegEx has to include the text itself that needs to be Important or Unimportant. This could be "Bak" to "ninth |" as Important, then everything else as unimportant. Or (as in your previous forum post) I grabbed the last cell by making a RegEx that is defined to match only the last cell of a line.
    Aaron P Scooter Software

    Comment


    • #3
      If you have a couple other examples, we can try to help find a commonality and help create a RegEx that'll meet your needs. The key is that we want a mask that will fully encapsulate the text you want to find and match on. We can then make that Important (and everything else Unimportant), or make it Unimportant.
      Aaron P Scooter Software

      Comment


      • #4
        Thanks (sorry for the duplicate post, I did not notice the message about delayed posts and thought it was another IE limitation! We can terminate one of the threads)

        I think the "BAK to the ninth |" would be a workable solution. The "BAK" string, the "|" delimiter, and the number of positions are the only predictable thing. How would you write that statement?

        Here are a couple of other examples where the ninth element is different between the 2 files, but the other elements are the same. (note that there are several other lines in each file, but those lines do not start with the "BAK" string)

        File 1: BAK|00|AC|A4094-2|20140130||10|NATIONAL|0001391143|20140530
        File 2: BAK|00|AC|A4094-2|20140130||10|NATIONAL|0001391143|20140423

        File 1: BAK|00|AC|Test CAD|20140408||10|KIMBALL|0000013518|20140530
        File 2: BAK|00|AC|Test CAD|20140408||10|KIMBALL|0000013518|20140520

        File 1: BAK|00|AC|D20 CHG 20144|20130703||10|NATIONAL|0000013000|20140527
        File 2: BAK|00|AC|D20 CHG 20144|20130703||10|NATIONAL|0000013000|20140422

        Comment


        • #5
          Hello,

          We can continue in one thread, where I posted a RegEx for matching on BAK+7, and Non-Bak.
          It wouldn't be able to then also ignore the 9th cell unless you created one more RegEx, counting back from the end of line$, but this would apply to all lines, not just Bak.


          Update: I forgot to include the link.
          http://www.scootersoftware.com/vbull...ad.php?t=13165
          Aaron P Scooter Software

          Comment

          Working...
          X