Using awk to summing from a given line

My file is something like this :

03.097
03.094
03.093
03.095
03.091
04.089
06.093
07.225
08.196
06.097
06.094
05.096
04.086

I'd like to sum it from a given line to another one , e.g.: from line 10 until line 20

What s the awk way solving this ?

thank you

Hi

$ awk 'NR>=10 && NR<=20{x+=$0;}END{print x}' file
21.373

Guru.

1 Like