August 5th, 2013, 12:07 PM
Merging contents of many files
I want to merge contents of many files as follows (following examples are with 2 files, but actually I have thousands of such files):
If my first file (file1.txt) contains-
and the second file (file2.txt) contains-
then the concatenated output file (out.txt) should contain-
note that the order of the file (first file1.txt then file2.txt) should not change..
August 5th, 2013, 01:01 PM
I'm confused, when you say >1st and >2nd are you indicating line numbers or are you suggesting the actual, verbatim text of the file?
What does this do? It sounds to me like there might be a much simpler way to do what you're really trying to do that might not have so much I/O involved.
August 5th, 2013, 01:30 PM
I could write anything instead of "1st" and "2nd" like "anything1" "anything2", they are just header descriptions,but
Originally Posted by Mr909
these descriptions are same in all the files, that means, if in file1.txt, the header descriptios are "anything1" and "anything2", for file2.txt
the header descriptios are also "anything1" and "anything2".
These header descriptions are used to match the content below it,, thus in output concatenated file, header description "1st" (or "anything1") have merged content of file1 and file2 that are also under the same header in those files(see sample ouput) ...
August 5th, 2013, 03:13 PM
Install unix (cygwin/x11 perhaps) then use the lam or paste commands.
[/code] are essential for python code and Makefiles!