I have a file containing tons of information. It looks like this:
===============================================================================
NSTEP ENERGY RMS GMAX NAME NUMBER
52 -4.8969E+05 5.1393E+00 1.7327E+03 P1 31
BOND = 29534.6906 ANGLE = 2139.5547 DIHED = 9235.7381
VDWAALS = 51148.8783 EEL = -595288.4773 HBOND = 0.0000
1-4 VDW = 2741.3848 1-4 EEL = 26043.4789 RESTRAINT = 29.3591
DFTBESCF= -15274.2075
EAMBER = -489718.9594
NMR restraints: Bond = 0.000 Angle = 0.000 Torsion = 0.000
===============================================================================
Now, I want to extract (and put in one column only) the value (here shown as -4.8969E+05) from the 'Energy' (or second) column in the line directly under the word ENERGY.
I tried to extract it with grep but have not been able to.
===belong to the file? do**belong? Also please note we are not a script writing service, some research effort is required. What have you tried so far? – Kamil Maciorowski Oct 31 '18 at 22:28editabove to the left, and add to your original post what we have asked for. Is the file you are trying to extract from tabulated; do {TAB} characters separate the columns, or are they separated by a number of spaces? If you can upload a sample file to someplace like Google Drive and share the URL so we might download it, that would speed resolution. Please also include what you tried with grep so far; it is far easier for us to fix a broken script than to write from scratch. – K7AAY Oct 31 '18 at 22:38cut -c M-Nto extract the columns you want, with some additional filters to remove the non-columnar data. – AFH Oct 31 '18 at 23:07