Select lines
The script described just below always integrates the whole spectrum. What if you want to select a part of it? The easiest way to select a certain number of lines in a file is this one:
head -n $last_line $filename | tail -n $nr_of_lines
Note that
nr_of_lines=$(($last_line-$first_line+1))