Is there possibility of copy ONLY difference of two files? Like in winmerge, but, I can\'t find this option
WinMerge offers the "Copy Left to..." or "Copy right to..." that will copy only the differences to a folder of choice.
There is a free app called DiffMerge.
Note : The option 'Show differences only' will be disabled until you switch to the bottom tab labeled Referenced View(Files as loaded). After that you should be able to use Differences Only view.
WinMerge has a built-in and simple way to generate such "diff only" files, that they called "patches".
Click on "Tool", then on "Generate Patch...", and enter where you want to store the result:
You will obtain (for your example) the file
4,8c4,8
< HELLO WORLD
< HELLO WORLD
< HELLO WORLD
< HELLO WORLD
< HELLO WORLD
---
>
>
>
>
>
That uses the standard, compact way of representing diff and is easy to manipulate.
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.
In winmerge there is very nice feature- in tools you can generate raport in html by Tools-> Raport. After that operation you can parse generated html- and in that way get only differenece (but maybe it's not simplest solution)
Here is how you do it in WinMerge: