#!/.bi/bash
#   				between

if test $# != 2
then
	clear 
	echo "
	between - Output a range of records from a table, prefixed by 
				the 3 header lines. 


	USAGE: between START END [std redirection in and out]


	EXAMPLE:   between 10 20 < PIRDEtable

		will output the header and lines 10 thru 20 of PIRDEtable.

	You must use redirection, < > | etc. to input the table. For
	head and tail use head and tail.
	"
exit
	
fi


if test $1 -gt $2
then 
	export HI=$2
	export LO=$1
else
	export LO=$2
	export HI=$1
fi



awk ' BEGIN {
	HI=ENVIRON["HI"]+3
	LO=ENVIRON["LO"]+3
	}
	
	NR==1
	NR==2
	NR==3
	( NR <= LO ) && ( NR >= HI )
	
	'

if test $1 -gt $2
then 
	echo "\`between' took the libery of swapping your reversed offsets." 
fi
######################################################################
