Copy only difference (kdiff, winmerge, any diff like tool)

前端 未结 6 917
名媛妹妹
名媛妹妹 2021-02-05 15:42

Is there possibility of copy ONLY difference of two files? Like in winmerge, but, I can\'t find this option\"enter

6条回答
  •  我在风中等你
    2021-02-05 16:11

    Most diff tools have a patch generation functionality which can work toward the clipboard, this is mostly what you want as you will get only changed text on left and right side (if you remove the context lines). If you want only those of one side you can easily filter the patch with regard to the first character (removing all lines, using an editor, matching something like ^[+>].*$ to keep removed lines or ^[-<].*$ to keep added lines).

    The diff tool in command line will output just that, piped with a grep and one of the above regular expression you are done.

提交回复
热议问题