I want to

* Open and read 1st file
* Open and read 2nd file
* Copy the values of 2nd file to 1st file with header
* Write new value to 1st file

That is, 1st file is opened as read-write mode and 2nd file is as read mode.
For instance,

1st\_file

```
     CHINESE    JAPANESE   KOREAN
CA   0.1        0.1        1.1
WA   0.2        -0.2       1.3
OR   -0.1       1.1        0.1
UT   0.3        1.4        -0.9

```

2nd\_file (no header)

```
1.1
1.3
-0.1
1.3

```

recreated 1st\_file

```
     CHINESE    JAPANESE   KOREAN    VIETNAMESE   TOTAL
CA   0.1        0.1        1.1       1.1          2.4
WA   0.2        -0.2       1.3       1.3          2.6
OR   -0.1       1.1        0.1      -0.1          1.0
UT   0.3        1.4        -0.9      1.3          2.1

```

Here, 2nd\_file contains the values about VIETNAMESE column.

So, first thing is to write the header, 1) VIETNAMESE and 2) TOTAL to the header of 1st\_file.

Then, write the value from 2nd\_file to the corresponded VIETNAMESE column of 1st\_column.

Finally, calculate the values of 1st\_column and write it (such as TOTAL) to the 1st\_column. 

I've tried to open 1st file with r+ mode but it did not well work. FYI, real 1st\_files has about 100 millions of rows and twenty columns.

How to do it?