1.

Solve : combining text files?

Answer»

hi all,

seek for help to combine several text files into one. i have USED the command

copy text1.txt+text2.txt result.txt

but..how can i copy the text2.txt to the FOLLOWING LINE of text1.txt?

for example, text1.txt:
aaaaa
aaaaa
text2.txt:
bbbbb
bbbbb

with the above command, i get the result:
aaaaa
aaaaabbbbb
bbbbb

how can i get the result as below:
aaaaa
aaaaa
bbbbb
bbbbb

please advice..I fail to see the problem. If text1.txt contains two records each with 5 bytes of "a" and text2.txt contains two records each with 5 bytes of "b" and you execute the command:

copy text1.txt+text2.txt result.txt

I can only PRODUCE:

aaaaa
aaaaa
bbbbb
bbbbb


How did you end up with:

aaaaa
aaaaabbbbb
bbbbb


How were text1.txt and text2.txt created?

8-)Hello,

@laily,

You PROBABLY have the two files (inclusive ) as follows:

for example, text1.txt:
aaaaa
aaaaa
text2.txt:
bbbbb
bbbbb

These weren't copied using the copy-command, resulting in what you got.
Sollution could be: add the CRLF behind the last record (making shure that the cursor is below the last record when editting the file...)

Alternatively, to 'add' files I use the 'type' command:

Adding together all files starting with A....
for %%p in (A*) do (
echo Adding file %%p
type %%p >> %TARGETFILE%
)

This works for me..


That's All Folks,

Sphermy.



Discussion

No Comment Found