I have a data file like this
0.000 1.185e-01 1.185e-01 3.660e-02 2.962e-02 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00
0.001 1.185e-01 1.185e-01 3.660e-02 2.962e-02 -1.534e-02 -1.534e-02 8.000e-31 8.000e-31 0.000e+00
0.002 1.185e-01 1.185e-01 3.659e-02 2.961e-02 -1.541e-02 -1.541e-02 -6.163e-01 -6.163e-01 -4.284e-05
0.003 1.186e-01 1.186e-01 3.657e-02 2.959e-02 -1.547e-02 -1.547e-02 -8.000e-31 -8.000e-31 0.000e+00
0.004 1.186e-01 1.186e-01 3.657e-02 2.959e-02 -2.005e-32 -2.005e-32 -8.000e-31 -8.000e-31 0.000e+00
0.005 1.186e-01 1.186e-01 3.657e-02 2.959e-02 -2.005e-32 -2.005e-32 -8.000e-31 -8.000e-31 0.000e+00
0.006 1.187e-01 1.186e-01 3.657e-02 2.959e-02 -2.005e-32 -2.005e-32 -8.000e-31 -8.000e-31 0.000e+00
0.007 1.187e-01 1.187e-01 3.657e-02 2.959e-02 -2.005e-32 -2.005e-32 -8.000e-31 -8.000e-31 0.000e+00
0.008 1.188e-01 1.187e-01 3.657e-02 2.959e-02 -2.005e-32 -2.005e-32 -8.000e-31 -8.000e-31 0.000e+00
0.009 1.188e-01 1.187e-01 3.657e-02 2.959e-02 -2.005e-32 -2.005e-32 -8.000e-31 -8.000e-31 0.000e+00
I want to copy only selected columns from this file to another file. Suppose I copy the 1st, 2nd and 6th columns to a file, then that file should look like
0.000 1.185e-01 0.000e+00
0.001 1.185e-01 -1.534e-02
0.002 1.185e-01 -1.541e-02
0.003 1.186e-01 -1.547e-02
0.004 1.186e-01 -2.005e-32
0.005 1.186e-01 -2.005e-32
0.006 1.187e-01 -2.005e-32
0.007 1.187e-01 -2.005e-32
0.008 1.188e-01 -2.005e-32
0.009 1.188e-01 -2.005e-32
This is a very large formatted text file which was initially written like this
f=open('myMD.dat','w')
s='%8.3e %8.3e %8.3e %8.3e %8.3e %8.3e %8.3e %8.3e %8.3e\t\t'%(xpos1[i],ypos1[i],xvel1[i],yvel1[i],xacc1[i],yacc1[i],xforc[i],yforc[i],potn[i])
f.write(s)
f.close()
I am programming in python. How can I do this?