I have a master file:
1)Master.txt
StoreCode
0001
|
|
|
|
5000
And I have up to 10 text(.txt) file:
1)T1.txt
2)T2.txt
3)T3.txt
4)T4.txt
5)T5.txt
6)T6.txt
7)T7.txt
8)T8.txt
9)T9.txt
10)T10.txt
Format:
T1.txt
StoreCode|Qty
0001|23
0002|45
0026|89
0234|100
0300|80
0560|10
1999|39
4600|20
T2.txt
StoreCode|Qty
0001|40
0003|30
0020|25
0214|10
0340|120
0760|105
3899|69
4800|20
T3.txt
StoreCode|Qty
0004|15
0007|30
0030|89
0134|100
0390|80
0660|10
2499|39
4900|20
I want the output file is:
store.csv
StoreCode,T1,T2,T3
0001,23,40
0002,45
0003,0,30
0004,0,0,15
0007,0,0,30
0020,0,25
0026,89
0030,0,0,89
0134,0,0,100
0214,0,10
0234,100
0300,80
0340,0,120
0390,0,0,80
0560,10
0660,0,0,10
0760,0,105
1999,39
2499,0,0,39
3899,69
4600,20
4800,0,20
4900,0,0,20
I want to load the master file code into temporary memory first, and then compare all the text file(Text file can either 1 file or up to 10 files). Finally, Wirte to a store.csv file. Anyone can help me? Thanks in advance.
1)Master.txt
StoreCode
0001
|
|
|
|
5000
And I have up to 10 text(.txt) file:
1)T1.txt
2)T2.txt
3)T3.txt
4)T4.txt
5)T5.txt
6)T6.txt
7)T7.txt
8)T8.txt
9)T9.txt
10)T10.txt
Format:
T1.txt
StoreCode|Qty
0001|23
0002|45
0026|89
0234|100
0300|80
0560|10
1999|39
4600|20
T2.txt
StoreCode|Qty
0001|40
0003|30
0020|25
0214|10
0340|120
0760|105
3899|69
4800|20
T3.txt
StoreCode|Qty
0004|15
0007|30
0030|89
0134|100
0390|80
0660|10
2499|39
4900|20
I want the output file is:
store.csv
StoreCode,T1,T2,T3
0001,23,40
0002,45
0003,0,30
0004,0,0,15
0007,0,0,30
0020,0,25
0026,89
0030,0,0,89
0134,0,0,100
0214,0,10
0234,100
0300,80
0340,0,120
0390,0,0,80
0560,10
0660,0,0,10
0760,0,105
1999,39
2499,0,0,39
3899,69
4600,20
4800,0,20
4900,0,0,20
I want to load the master file code into temporary memory first, and then compare all the text file(Text file can either 1 file or up to 10 files). Finally, Wirte to a store.csv file. Anyone can help me? Thanks in advance.