#!/usr/bin/muawk
# rustic tail (by M. Andreoli)

BEGIN	{
	n=split(arg,opts)	
	
	if (n==0) opt=-10;
	else
		opt=opts[1];

	if (opt=="-h" )
		{
		print "(rustic) tail -- output the last part of stdin." 
		print "\tEx: tail -3 -- last 3 row"
		print "\tEx: tail +3 -- skip first 3 row"
		exit
		}
	}


	{line[NR]=$0 "" }

END	{
	if (opt >= 0 )
		for (i=opt+1; i<=NR; i++) print line[i];
	if (opt < 0  )
		for (i=NR+opt+1; i<=NR; i++) print line[i];
	}
