Shell script that accepts a file name starting and ending line numbers as arguments and displays all the lines between the given line numbers

				
					if [ $# -ne 3 ]
then
echo “check the arguments once”
lastline=‟wc –l < $1‟
if [ $2 –lt $lastline –a $3 -le $lastline ]
then
nline=‟expr $3 -$2 + 1‟
echo “‟tail +$2 $1 | head -$nline‟”
else
echo “invalid range specification”
fi
fi
				
			

Leave a Reply