For some more statistics, I counted the headers in my
/usr/share/man directory. Here are the results:
# % Header
1: 81.96 NAME
2: 79.75 DESCRIPTION
3: 74.54 SYNOPSIS
4: 60.26 SEE ALSO
5: 25.86 STANDARD OPTIONS
6: 24.25 KEYWORDS
7: 22.32 AUTHOR
8: 19.04 ARGUMENTS
9: 15.88 OPTIONS
10: 15.74 BUGS
11: 11.62 CONFORMING TO
12: 11.60 FILES
13: 11.48 RETURN VALUE
14: 9.58 ERRORS
15: 8.25 NOTES
16: 5.66 COPYRIGHT
17: 4.80 ACKNOWLEDGEMENTS
18: 4.61 AUTHORS
19: 4.06 EXAMPLES
20: 3.61 ENVIRONMENT
21: 3.26 REPORTING BUGS
22: 2.23 DIAGNOSTICS
23: 2.14 EXAMPLE
24: 2.09 HISTORY
25: 2.02 INTRODUCTION
26: 1.85 VERSION
27: 1.21 CONFIGURATION
28: 1.19 AVAILABILITY
29: 1.16 WIDGET-SPECIFIC OPTIONS
30: 1.14 NOTE
Total files: 4207.
And the program that created them:
#!/usr/bin/perl
use strict;
use warnings;
my $mandir = "/usr/share/man";
my %headers;
my $count = 0;
sub peek {
my $file = shift;
open my $fh => "gunzip -c $file |" or die "open $file: $!";
while (<$fh>) {
next unless /^\.SH\s*(.*)/;
my $header = $1;
$header =~ s/\s+$//;
$header =~ s/^"(.*)"\s*$/$1/;
$headers {$header} ++;
}
close $fh;
$count ++;
}
foreach my $file (<$mandir/*/*.?.gz>) {
next if -l $file;
peek $file;
}
my $i = 0;
print " # % Header\n";
foreach my $header (sort {$headers {$b} <=> $headers {$a}} keys %heade
+rs) {
last if 1 > (my $perc = 100 * $headers {$header} / $count);
printf "%2d: %6.2f %s\n" => ++ $i, $perc, $header;
}
print "Total files: $count.\n";
__END__
Abigail