I"m looking for a way to grep the last occurrence of a line, e.g. running
$grep "!" ibrav8_c11mc12/*
returns:
ibrav8_c11mc12/MgO.scf.a=0.090.ecut=80.k=4.out:! total energy = -608.35146103 Ry
ibrav8_c11mc12/MgO.scf.a=0.090.ecut=80.k=4.out:! total energy = -608.35234197 Ry
ibrav8_c11mc12/MgO.scf.a=0.090.ecut=80.k=4.out:! total energy = -608.35243673 Ry
ibrav8_c11mc12/MgO.scf.a=0.095.ecut=80.k=4.out:! total energy = -607.63532091 Ry
ibrav8_c11mc12/MgO.scf.a=0.095.ecut=80.k=4.out:! total energy = -608.28250682 Ry
ibrav8_c11mc12/MgO.scf.a=0.095.ecut=80.k=4.out:! total energy = -608.33000791 Ry
ibrav8_c11mc12/MgO.scf.a=0.095.ecut=80.k=4.out:! total energy = -608.34213906 Ry
ibrav8_c11mc12/MgO.scf.a=0.095.ecut=80.k=4.out:! total energy = -608.34395220 Ry
ibrav8_c11mc12/MgO.scf.a=0.095.ecut=80.k=4.out:! total energy = -608.34488323 Ry
ibrav8_c11mc12/MgO.scf.a=0.095.ecut=80.k=4.out:! total energy = -608.34496519 Ry
ibrav8_c11mc12/MgO.scf.a=0.100.ecut=80.k=4.out:! total energy = -607.48596003 Ry
ibrav8_c11mc12/MgO.scf.a=0.100.ecut=80.k=4.out:! total energy = -608.28313222 Ry
ibrav8_c11mc12/MgO.scf.a=0.100.ecut=80.k=4.out:! total energy = -608.32079049 Ry
ibrav8_c11mc12/MgO.scf.a=0.100.ecut=80.k=4.out:! total energy = -608.33433606 Ry
ibrav8_c11mc12/MgO.scf.a=0.100.ecut=80.k=4.out:! total energy = -608.33598793 Ry
ibrav8_c11mc12/MgO.scf.a=0.100.ecut=80.k=4.out:! total energy = -608.33685159 Ry
ibrav8_c11mc12/MgO.scf.a=0.100.ecut=80.k=4.out:! total energy = -608.33690888 Ry
But I just want the last occurrence from each file, there is a -m option,
grep "!" -m 1 ibrav8_c11mc12/*
But this returns the first occurrence from each file. What I want, essentially is the opposite of this option.