I am doing some operation on a file which represents a molecular system in PDB file format.
The format of the file which I am operating now is as below and this represents only one PDB file:
Code:
REMARKS
ATOM 1 O22 DDM 1 5.844 4.178 7.821 0.00 0.00
ATOM 2 H62 DDM 1 6.423 4.054 8.578 0.00 0.00
ATOM 3 C22 DDM 1 6.606 4.907 6.827 0.00 0.00
TER
ATOM 163 O22 DDM 3 3.758 10.266 8.321 0.00 0.00
ATOM 164 H62 DDM 3 4.450 10.757 8.770 0.00 0.00
ATOM 165 C22 DDM 3 3.346 10.797 7.028 0.00 0.00
TER
ATOM 325 O22 DDM 5 8.310 1.239 14.788 0.00 0.00
ATOM 326 H62 DDM 5 8.858 0.914 15.507 0.00 0.00
ATOM 327 C22 DDM 5 9.143 2.061 13.825 0.00 0.00
TER
END
Basically I want to change the sequence of the numbers in the second and fifth column.
To achive this I generated two seperate files which contain the number in the sequence of.
and
Now I am trying to replace the first sequence in the second column and the second sequence in the fifth column and finally get the format as below:
Code:
REMARKS
ATOM 1 O22 DDM 1 5.844 4.178 7.821 0.00 0.00
ATOM 2 H62 DDM 1 6.423 4.054 8.578 0.00 0.00
ATOM 3 C22 DDM 1 6.606 4.907 6.827 0.00 0.00
TER
ATOM 4 O22 DDM 2 3.758 10.266 8.321 0.00 0.00
ATOM 5 H62 DDM 2 4.450 10.757 8.770 0.00 0.00
ATOM 6 C22 DDM 2 3.346 10.797 7.028 0.00 0.00
TER
ATOM 7 O22 DDM 3 8.310 1.239 14.788 0.00 0.00
ATOM 8 H62 DDM 3 8.858 0.914 15.507 0.00 0.00
ATOM 9 C22 DDM 3 9.143 2.061 13.825 0.00 0.00
TER
END
I want to do this for each PDB file. But I need some help on how to replace this columns file after file.
I really appreciate any help to achieve this.
Vijay