I'm new to python coding, and I have this two text files that I need to manipulate. Does anyone know how to replace specific columns of one file into another files columns? So, for example, I want to take the last four columns of the 'test1.txt',
1 N1 -3.8340 -1.0640 2.8770 n3 1 UNL -0.696600
2 N2 -2.7490 -1.5690 2.2220 n3 1 UNL -0.278400
3 C1 -2.3750 -0.9950 1.1200 c3 1 UNL 0.169400
4 C2 -1.2280 -1.5720 0.2740 c3 1 UNL 0.671800
and replace only the last four columns of first text into 'test2.txt' --note that when it repeats it, the integer in the third to last column will increase.
1 N1 31.2480 39.4030 91.8950 N.3 1 UNL 0.000000
2 N2 32.0980 38.3940 91.5460 N.2 1 UNL 0.000000
3 C1 33.0530 38.6590 90.7070 C.2 1 UNL 0.000000
4 C2 33.9820 37.5500 90.1880 C.2 1 UNL 0.000000
5 N1 55.1040 41.1430 27.6790 N.3 2 UNL 0.000000
6 N2 53.9860 41.7250 27.1570 N.2 2 UNL 0.000000
7 C1 53.7640 41.5940 25.8850 C.2 2 UNL 0.000000
8 C2 52.5820 42.3090 25.2080 C.2 2 UNL 0.000000
so that the final result becomes
1 N1 31.2480 39.4030 91.8950 n3 1 UNL -0.696600
2 N2 32.0980 38.3940 91.5460 n3 1 UNL -0.278400
3 C1 33.0530 38.6590 90.7070 c3 1 UNL 0.169400
4 C2 33.9820 37.5500 90.1880 c3 1 UNL 0.671800
5 N1 55.1040 41.1430 27.6790 n3 2 UNL -0.696600
6 N2 53.9860 41.7250 27.1570 n3 2 UNL -0.278400
7 C1 53.7640 41.5940 25.8850 c3 2 UNL 0.169400
8 C2 52.5820 42.3090 25.2080 c3 2 UNL 0.671800
like this... Is this even a possibility with python coding? The two files are saved in two different filenames.