Blame test/numindex.awk

Packit 575503
#To: bug-gnu-utils@gnu.org
Packit 575503
#cc: arnold@gnu.org
Packit 575503
#Subject: Possible bug in GNU Awk 3.0.4
Packit 575503
#Date: Wed, 24 Nov 1999 21:47:24 +0000
Packit 575503
#From: Daniel Elphick <de397@ecs.soton.ac.uk>
Packit 575503
#Message-Id: <E11qkG4-0000l0-00@cameron>
Packit 575503
#
Packit 575503
#This is a multipart MIME message.
Packit 575503
#
Packit 575503
#--==_Exmh_-11192982200
Packit 575503
#Content-Type: text/plain; charset=us-ascii
Packit 575503
#
Packit 575503
#
Packit 575503
#When I use the attached awk script unique on the attached data file, it 
Packit 575503
#reports that all 4 lines of the data are the same. Using mawk it correctly 
Packit 575503
#reports that there are no repeats.
Packit 575503
#
Packit 575503
#I don't know if there are limits on the size of associative array keys for the 
Packit 575503
#purposes of reliable indexing but if there is then it is not (obviously) 
Packit 575503
#documented.
Packit 575503
#
Packit 575503
#
Packit 575503
#--==_Exmh_-11192982200
Packit 575503
#Content-Type: text/plain ; name="data"; charset=us-ascii
Packit 575503
#Content-Description: data
Packit 575503
#Content-Disposition: attachment; filename="data"
Packit 575503
#
Packit 575503
#322322111111112232231111
Packit 575503
#322322111111112213223111
Packit 575503
#322322111111112211132231
Packit 575503
#322322111111112211113223
Packit 575503
#
Packit 575503
#--==_Exmh_-11192982200
Packit 575503
#Content-Type: text/plain ; name="unique"; charset=us-ascii
Packit 575503
#Content-Description: unique
Packit 575503
#Content-Disposition: attachment; filename="unique"
Packit 575503
#
Packit 575503
{
Packit 575503
	if($0 in a)
Packit 575503
	{
Packit 575503
		printf("line %d has been seen before at line %d\n",  NR, a[$0])
Packit 575503
		repeat_count += 1
Packit 575503
	}
Packit 575503
	else
Packit 575503
	{
Packit 575503
		a[$0] = NR
Packit 575503
	}
Packit 575503
	count += 1
Packit 575503
}
Packit 575503
END {
Packit 575503
#	printf("%d %f%%\n", repeat_count, (float)repeat_count / count * 100)
Packit 575503
	printf("%d %f%%\n", repeat_count, repeat_count / count * 100)
Packit 575503
}
Packit 575503
#
Packit 575503
#--==_Exmh_-11192982200--