I need to combine several TXT files, the number of files may vary, and the data contents of the files will need to be in specific places in the combined file. Some of the data files will be similar as will contain values at different time steps. Each of the files will contain their own variables, but the combined file needs all the variables, and the data for those variables in their own columns. One of my problems is that some files that contain data for different timesteps does not contain all the same columns, but one column that is shared. More specifically, some files contain xy coordinates along with a node number for those coordinates, while other files only have the node numbers. These are just straight text data files... no database or XML is used. If anyone has had a similar situation or has an idea of how I can do this, I'd appreciate the help. Here's a simplified example of what I'm trying to do:
File 1:
TITLE = "Title"
VARIABLES = "X" "Y" "node" "A" "B" "C"
ZONE T ="T1", N = 5, E = 3
0.000 0.000 00001 0.0000 0.0000 0.0000
10.000 0.000 00002 0.0000 0.0000 0.0000
20.000 0.000 00003 0.0000 0.0000 0.0000
15.000 5.000 00004 0.0000 0.0000 0.0000
5.000 5.000 00005 0.0000 0.0000 0.0000
1 2 5
2 3 4
4 5 2
File 2:
ZONE T ="T2", N = 5, E = 3
00001 0.2200 0.2200 0.0000
00002 0.4400 0.4400 0.0000
00003 0.6600 0.6600 0.0000
00004 0.8800 0.8800 0.0000
00005 1.0100 1.0100 0.0000
File 3:
TITLE = "Title"
VARIABLES = "X" "Y" "node" "D" "E"
ZONE T ="T1", N = 5, E = 3
0.000 0.000 00001 0.0000 0.0000
10.000 0.000 00002 0.0000 0.0000
20.000 0.000 00003 0.0000 0.0000
15.000 5.000 00004 0.0000 0.0000
5.000 5.000 00005 0.0000 0.0000
1 2 5
2 3 4
4 5 2
File 4:
ZONE T ="T2", N = 5, E = 3
00001 0.0330 0.0808
00002 0.0550 0.0707
00003 0.0770 0.0606
00004 0.0990 0.0505
00005 0.2020 0.0101
File 5:
VARIABLES = "X" "Y" "node" "F" "G" "H"
ZONE T = "R", N = 5, E = 3
0.000 0.000 00001 0.0000 0.0500 0.0010
10.000 0.000 00002 1.0000 0.0600 0.0030
20.000 0.000 00003 2.0000 0.0700 0.0050
15.000 5.000 00004 3.0000 0.0800 0.0070
5.000 5.000 00005 4.0000 0.0900 0.0090
1 2 5
2 3 4
4 5 2
Combined File:
TITLE = "Title"
VARIABLES = "X" "Y" "node" "A" "B" "C" "D" "E" "F" "G" "H"
ZONE T ="T1", N = 5, E = 3
0.000 0.000 00001 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0500 0.0010
10.000 0.000 00002 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0600 0.0030
20.000 0.000 00003 0.0000 0.0000 0.0000 0.0000 0.0000 2.0000 0.0700 0.0050
15.000 5.000 00004 0.0000 0.0000 0.0000 0.0000 0.0000 3.0000 0.0800 0.0070
5.000 5.000 00005 0.0000 0.0000 0.0000 0.0000 0.0000 4.0000 0.0900 0.0090
1 2 5
2 3 4
4 5 2
ZONE T ="T2", N = 5, E = 3
0.000 0.000 00001 0.2200 0.2200 0.0000 0.0330 0.0808 0.0000 0.0500 0.0010
10.000 0.000 00002 0.4400 0.4400 0.0000 0.0550 0.0707 1.0000 0.0600 0.0030
20.000 0.000 00003 0.6600 0.6600 0.0000 0.0770 0.0606 2.0000 0.0700 0.0050
15.000 5.000 00004 0.8800 0.8800 0.0000 0.0990 0.0505 3.0000 0.0800 0.0070
5.000 5.000 00005 1.0100 1.0100 0.0000 0.2020 0.0101 4.0000 0.0900 0.0090
1 2 5
2 3 4
4 5 2