Page 1 of 3

Merge multiple files

Posted: Sun Dec 15, 2013 11:25 am
by clanc789
Hey coders,

For school I've to create a huge dictionary (why would they let students do that...) and I've got a couple of problems. Several files are have a really big amount of words (17 million), each word is on a line resulting in 17 million lines. I need all these lines to be in 1 big file named all.txt. So far copy+paste works fine, but for those big files my notepad++ crashes (c++ runtime error, unexpected). Anybody got an idea which program to use to be able to open these? It'd really help me out.

Kind regards,
Max

Re: Merge multiple files

Posted: Sun Dec 15, 2013 11:31 am
by comathi
Does it matter in which order words are merged in the file?

Re: Merge multiple files

Posted: Sun Dec 15, 2013 11:35 am
by clanc789
No, as long as there is only 1 word per line. Alphabetical order does not matter at all.

Re: Merge multiple files

Posted: Sun Dec 15, 2013 12:01 pm
by comathi
If you're looking into writing a small application to ease your task, try this:

http://www.codeproject.com/Questions/40 ... -in-VB-NET

Using a StreamReader would enable you to read very large files... Just read it line by line and write it in your destination file cooll;

Re: Merge multiple files

Posted: Sun Dec 15, 2013 12:02 pm
by clanc789
comathi wrote:
If you're looking into writing a small application to ease your task, try this:

http://www.codeproject.com/Questions/40 ... -in-VB-NET

Using a StreamReader would enable you to read very large files... Just read it line by line and write it in your destination file cooll;
Will try after lunch, a big thanks already for the effort :D

Re: Merge multiple files

Posted: Sun Dec 15, 2013 12:04 pm
by comathi
No problem... I'd write something for you, but I'm on my laptop at the moment... Later on in the day I could try something if you still don't have it working :)

Re: Merge multiple files

Posted: Sun Dec 15, 2013 1:34 pm
by clanc789
Hey Comathi,

The link you posted does not really make sense to me (in terms of: I dont understand it really). If you could help me with that, that'd be great :D

EDIT: I've got a file that has 8 million lines and one of 14 million lines and I need to add these together. I dont know if you need the numbers exactly?

Re: Merge multiple files

Posted: Sun Dec 15, 2013 1:46 pm
by Shim
I think it would be easier if you do that with xml instead of txt

Re: Merge multiple files

Posted: Sun Dec 15, 2013 1:49 pm
by Filip
mshimranpro wrote:
I think it would be easier if you do that with xml instead of txt
xml is in plain text format. I would rather use MySQL.

Re: Merge multiple files

Posted: Sun Dec 15, 2013 1:54 pm
by clanc789
Why not plain text? There is no need for security or anything. You guys made me curious now :)