#!/usr/local/bin/perl 
#
# FROM THE FIRST OUTPUT THAT LISTS ALL THE UNDEFINED
# LABELS FROM A latex RUN, THIS SCRIPT EXTRACTS THE
# LABELS IN THE ORDER OF APPEARANCE AND OUTPUTS THEIR
# FIRST OCCURRENCE ONLY.
#

while (<>) {
   if (/LaTeX Warning: Citation/) {
	@a = split(' ',$_);
#	print $a[3],"\n";
	$b{$a[3]}++;
#	if ($b{$a[3]} == 1) print $a[3],"\n";
	print $a[3],"\n" if ($b{$a[3]} == 1) ;
   }
}

#foreach $key (keys(%b)) {
#	print $key," ",$b{$key},"\n";
#}