Gnuplot plotting data from a file up to some row
You can probably cut out the reliance on an external utility (If your system doesn't have them installed for example) using the pseudo-column 0.
see help plot datafile using pseudocolumn
Try something like:
LINEMIN=1000
LINEMAX=2000
#create a function that accepts linenumber as first arg
#an returns second arg if linenumber in the given range.
InRange(x,y)=((x>=LINEMIN) ? ((x<=LINEMAX) ? y:1/0) : 1/0)
plot "filename.txt" using (InRange($0,$1)):2 with lines
(tested on Gnuplot 4.4.2, Linux)
It appears that the "every" command in gnuplot is what you're looking for:
plot "filename.txt" every ::1000::2000 using 1:2 with lines
Alternatively, pre-process your file to select the rows in which you are interested. For example, using awk:
awk "NR>=1000 && NR<=2000" filename.txt > processed.txt
Then use the resulting "processed.txt" in your existing gnuplot command/script.
Simpler:
plot "<(sed -n '1000,2000p' filename.txt)" using 1:2 with lines