perl -wn000e '$start=1034; $end=1047; $pre=$start-1; $len=$end-$start+1; print / (?:.*\n){$pre} ( (?:.*\n){$len} ) /mx ' <>