Hi I am trying to get data from log file to extract specific data to control my progress.
I have written a code for open, read and write but I couldn't handle to get specific data.
import sys
file=open(sys.argv[1],"r")
file2=open('Data','a') if
file.mode == "r":
contents =file.read()
print >> file2, contents
Depend to progress energy data is changing
for example for A progress energy count is 2500 but for B its energy count is 3000
output raw data
ETITLE: TS BOND ANGLE DIHED IMPRP ELECT VDW BOUNDARY MISC KINETIC TOTAL TEMP POTENTIAL TOTAL3 TEMPAVG
ENERGY: 0 263.6137 847.5817 263.7656 10.7299 -17411.2458 1948.8251 4767.8559 0.0000 0.0000 -9308.8739 0.0000 -9308.8739 -9308.8739 0.0000
ENERGY: 1 263.2889 846.9560 263.8744 10.9840 -17411.4025 1712.6659 4767.8559 0.0000 0.0000 -9545.7775 0.0000 -9545.7775 -9545.7775 0.0000
the data I want to get is the energy number and the potential energy.
example output I want to write to my Data:
Energy: 0 |Potential: -9308
Energy: 1 |Potential: -9508
How can I write a code to handle this situation ?