I use grep
to find the string "Converged?"
with the terminal in several folders to read the output from my gaussian calculations.
My command is
grep -r -i -A4 Converged?
What I get as output is in minimal example this:
start_struc.log: Item Value Threshold Converged?
start_struc.log- Maximum Force 0.000022 0.000450 YES
start_struc.log- RMS Force 0.000005 0.000300 YES
start_struc.log- Maximum Displacement 0.010813 0.001800 NO
start_struc.log- RMS Displacement 0.002734 0.001200 NO
--
start_struc.log: Item Value Threshold Converged?
start_struc.log- Maximum Force 0.000001 0.000450 YES
start_struc.log- RMS Force 0.000000 0.000300 YES
start_struc.log- Maximum Displacement 0.001210 0.001800 YES
start_struc.log- RMS Displacement 0.000312 0.001200 YES
But I just want the last time grep finds Converged?
with the next four Lines.
I looked up different internet forums and the manual of grep but I think I did not find a flag I can use. Because the problem is, I get up to 50 hits before and I don't want to print them out in terminal.
Has someone an idea or search for the convergence the same way?
Thanks in advance