################################################ # This script is used to get some interesting # # information from the latest kernel ChangeLog # # -------------------------------------------- # # Usage: kernel-stats.pl changelog-version.txt # ################################################ #!/usr/bin/perl @stat = stat($ARGV[0]); $size = $stat[7]; while (<>) { if ($ret = isValidEmail($_)) { #print "$ret\n"; $hash{$ret}++; } $line_count++; $ret = ""; } @emails = keys(%hash); $all_emails = join("\n",@emails); $num_emails = scalar(@emails); @sort = sort{$hash{$b} <=> $hash{$a}} keys %hash; for ($i = 0;$i<5;$i++) { $name = $sort[$i]; $count = $hash{$name}; $top_five .= "$name submitted $count patches\n"; } print "Size in bytes: $size\n"; print "Number of lines: $line_count\n"; print "Unique contributors: $num_emails\n"; print "\nTop contributors:\n$top_five"; sub isValidEmail() { my $line = shift(); if ($line =~ /([\w-]+(?:\.[\w-]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7})/) { return $1; } }