I had a line of Python code that produced what I wanted. The code was:
os.system('cat {0}|egrep {1} > file.txt' .format(full,epoch))
and produced a file with the following contents:
3                321.000 53420.7046629965511    0.299                 0.00000
3                325.000 53420.7046629860714    0.270                 0.00000
3                329.000 53420.7046629846442    0.334                 0.00000
3                333.000 53420.7046629918374    0.280                 0.00000
I then just wanted to adjust the code so that is said "TEXT 1" at the top, so I tried the first thing that came into my head, and I changed the code to:
h = open('file.txt','w')
h.write('MODE 2\n')
os.system('cat {0}|egrep {1} > file.txt' .format(full,epoch))
When I do this, I get the output:
TEXT 1
   317.000 54519.6975201839344    0.627                 0.00000
3                321.000 54519.6975202038578    0.655                 0.00000
3                325.000 54519.6975201934045    0.608                 0.00000
3                329.000 54519.6975201919911    0.612                 0.00000
i.e. the first line after "TEXT 1" is not right, and is missing the first "3". Can anyone tell me what I am doing wrong, and possibly a better way to do this simple task.
Thank you.
 
     
    