Announcement

Collapse
No announcement yet.

Display headings when comparing 2 text files

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • Display headings when comparing 2 text files

    I'm trying to display two text files differences but also include the associated heading for context. in addition the number of context, lines don't work since the size of each section varies


    eg.
    file1.txt
    ======

    heading0:
    line1
    line2

    heading1:
    line3
    line4
    line5

    heading2:
    line6
    line7
    line8
    line9



    file2.txt
    ======

    heading0:
    line1
    line2a

    heading1:
    line3
    line4
    line5

    heading2:
    line6a
    line7
    line8
    line9a

    Output of differences
    ==========

    heading0:
    line2a

    heading2:
    line6a
    line9a

  • #2
    There isn't a built-in method to define this concept. However, there is a workaround which might work.

    Create a File Format (Tools menu) for your files, and define a Grammar Element to match on Heading text. This will still be an Important grammar element.
    Clone this format so there are two copies, and edit the clone and rename the header grammar element's name so it has a new custom name.

    When comparing your files, use the format dropdown above the text pane (or the Session menu -> Session Settings dialog, Format tab, override Detected on one side) to change one side to use the other format. This will make the header text a difference because of the difference in detected grammar element name even though the text itself may be the same, so they would be included in any difference view.
    Aaron P Scooter Software

    Comment

    Working...
    X
    😀
    🥰
    🤢
    😎
    😡
    👍
    👎