Community
    • Login

    Compare plugin, output a list of line numbers that do not match

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 28 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Robert Or Janet DiebelR
      Robert Or Janet Diebel
      last edited by

      I wish to be able to run a compare and output a list of line numbers that do not match. This, whether with Notepad++, the Compare plugin, or some other utility.

      All help much appreciated.
      Bob D.

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Robert Or Janet Diebel
        last edited by PeterJones

        @Robert-Or-Janet-Diebel said in Compare plugin, output a list of line numbers that do not match:

        I wish to be able to run a compare and output a list of line numbers that do not match. This, whether with Notepad++, the Compare plugin, or some other utility.

        “some other utility”: GNU’s diff command (which there are various ports to windows) could make a diff file or patch report similar to what’s described below. But anything that’s outside of Notepad++ and its plugins is OFF TOPIC here, so you’d have to look elsewhere for details of how to do that. Please don’t ask for off-topic (non-Notepad++) suggestions until it’s 100% certain that it can’t/shouldn’t be done in in Notepad++, and don’t expect more than hints if that’s the only way, because this isn’t a generic “transoform my text for me” forum.

        Never use Compare plugin; it is out of date and no longer supported, and has known dark-mode bugs. ComparePlus is the updated version of the Compare Plugin, and is the plugin you should use for comparing files.

        ComparePlus has had Generate Patch action since v2.0.0. That comes close to what you want, in that it generates a new file that has all the differences in an industry-standard “patch” file, which does list the line numbers that are different, but also includes the changes needed to convert from old to new version, so it might be more than what you want. But you could extract the info you wanted from that patch file.

        For example, if you had a patch file that looked like

        --- new 2
        +++ new 3
        @@ -1,6 +1,7 @@
         one
        -two
        +two2
         three
        +four has more
         alpha
         beta
         gamma
        @@ -16,4 +17,4 @@
         nu
         xi
         omicron
        -pi
        +pie
        

        the lines in the @@ would indicate the lines that had changes (sometimes with context lines around them.

        • -1,6 +1,7 says that “in the LEFT file, starting at line 1 for a total 6 lines, it is changed to the RIGHT file starting at line 1 and for a total of 7 lines”
        • -16,4 +17,4 says “in the LEFT file, starting at line 16 with 4 lines, it is changed to the RIGHT file starting at line 17 for 4 lines.”

        So if you did a MARK for ^@@.*$ in regex mode and then Copy Marked Text, it would put all those line-number indicators in the clipboard, and you could paste those into a new tab that would just have the indications of which lines are changed.

        1 Reply Last reply Reply Quote 1
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors