grabing a number six lines below a pattern

前端 未结 4 1095
耶瑟儿~
耶瑟儿~ 2021-01-20 16:19

I have these lines repeating

                               FINAL RESULTS



    NSTEP       ENERGY          RMS            GMAX         NAME    NUMBER
    1         


        
4条回答
  •  攒了一身酷
    2021-01-20 17:10

    This might work for you:

    awk '/FINAL RESULTS/{f=1;p=0}{p++}f==1 && p==6{print $2}' file
    

    Or if you like:

    awk 'f==2 && p==1{print $2}{p++}/FINAL RESULTS/{f=1}/ENERGY/ && f==1{f=2;p=0}' file
    

提交回复
热议问题