T
Tony Bansten
Assume I have two text files with multiple (long) lines each.
Now I want to merge them insofar that duplicate parts are eliminated
and the remaining parts are merged. Say I have the following files:
---- file1.txt ----
a aaa
bbbb
cccc
dddd
-------------------
---- file2.txt ----
cccc
dddd
eee
ff fff
-------------------
Then the resulting file should look like:
---- result.txt ---
a aaa
bbbb
cccc
dddd
eee
ff fff
-------------------
How can I code this with VB?
Keep in mind that there can be various combinations.
E.g. file2.txt could contain only a subset of lines:
---- file2b.txt ---
bbbb
cccc
-------------------
Then the result would be the file1.txt
Or - next variant - lines of file2.txt could overlap in front of file1.txt like
---- file2c.txt ---
kkk kkk
zz zzzzzz
a aaa
bbbb
-------------------
Would result in a resultfile
---- result3.txt ----
kkk kkk
zz zzzzzz
a aaa
bbbb
cccc
dddd
---------------------
Again: How can I code such a merge textfiles utility?
The vbscript should later be callable from commandline like
mymergetool.vb file1.txt file2.txt >result.txt
Tony
Now I want to merge them insofar that duplicate parts are eliminated
and the remaining parts are merged. Say I have the following files:
---- file1.txt ----
a aaa
bbbb
cccc
dddd
-------------------
---- file2.txt ----
cccc
dddd
eee
ff fff
-------------------
Then the resulting file should look like:
---- result.txt ---
a aaa
bbbb
cccc
dddd
eee
ff fff
-------------------
How can I code this with VB?
Keep in mind that there can be various combinations.
E.g. file2.txt could contain only a subset of lines:
---- file2b.txt ---
bbbb
cccc
-------------------
Then the result would be the file1.txt
Or - next variant - lines of file2.txt could overlap in front of file1.txt like
---- file2c.txt ---
kkk kkk
zz zzzzzz
a aaa
bbbb
-------------------
Would result in a resultfile
---- result3.txt ----
kkk kkk
zz zzzzzz
a aaa
bbbb
cccc
dddd
---------------------
Again: How can I code such a merge textfiles utility?
The vbscript should later be callable from commandline like
mymergetool.vb file1.txt file2.txt >result.txt
Tony