|Thank you for the response and your solution. As I am new to posting questions, I have learned the value of posting a clear description of the problem. Your script does exactly what I requested. It also shows me where I had critical omissions in my question and description. |
In my example of a file, I used "ID" to imply a variable like stuff1, etc. You interpreted this as a constant and your script writes the letters ID at the start of each line. Can this be modified to use instead the value of ID found in column 1 of the input files. The ID could be a text string or a number. When the two files are joined, can they be matched on the value of ID so that the values in the "goodies" columns correspond to the same ID?
In my search I found two scripts that sparked ideas for improvements. You contributed to a solution at http://www.computing.net/answers/pr... where a DIR command was done and the file names were used in the output file as column headers. Very nice and useful! Is this a possible enhancement? You also contributed to a solution at http://www.computing.net/answers/pr... where two files were joined. Nice. Thanks for these contributions.
Given all of that, here is a modified version of the file formats:
Here is 3 lines of file1
175 stuff1 stuff2 stuff3 stuff4 goodies_N_1
120 stuff1 stuff2 stuff3 stuff4 goodies_N_1
100 stuff1 stuff2 stuff3 stuff4 goodies_N_1
Here is 3 lines of file 2
100 stuff1 stuff2 stuff3 stuff4 goodies_N_2
120 stuff1 stuff2 stuff3 stuff4 goodies_N_2
175 stuff1 stuff2 stuff3 stuff4 goodies_N_2
the output file should look like
ID Filename1 Filename2
100 goodies_N_1 goodies_N_2
120 goodies_N_1 goodies_N_2
175 goodies_N_1 goodies_N_2
Thanks again for considering this request and the time you spend on it.