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

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

	if (opt=="-h" )
		{
		print "(rustic) uniq [-h|-c] \
-- remove duplicate lines from (stdin)." 
		print "\twith -c, print a count of lines."
		exit
		}
	}


	{count[$0]++ }

END	{
	if (opt=="-c")
	for ( x in count ) printf( "%7d %s\n", count[x],x);
	else
	for ( x in count ) print x;
	
	
	}
