I'm running a scripts on a text file, and I want to merge its contents. Let's say that the file is called "file1".
file1:
This is some text, wow!
Now I have few versions after running scripts.
file2:
My<> is some text, wow!
file3:
Yours<> is some text, wow!
file4:
This is some txt<>, wow!
As you can see, some words are changed to another, and have <> added. Now I want to merge these files, so that the words are merged if they got changed:
Output:
My<>Yours<> is some txt<>, wow!
The order doesn't really matter; they just have to be merged. Is there tool that could make this easy?
file1..4
? and how you are deciding that which word will remain in final output file ?My<>Yours<>
could beYours<>My<>
insteadword<>
; we merge by the rule: if the word got changed in at least one file, merge the changed versions and replace old word with changed merged version. Thus,text
->txt<>
,This
->My<>Yours<>
(or, as noted,Yours<>My<>
) andsome
->some
. We might merge files 1..4 or 2..4, doesn't matter; we won't need anything from file1(except for original order, if needed).