#!/usr/bin/perl -w use strict; my ($author, $desc, %map); my $pstate = 1; while (<>) { # get author if ($pstate == 1) { next unless /^Author: (.*)$/; $author = $1; $pstate++; } # skip to blank line elsif ($pstate == 2) { next unless /^\s*$/; $pstate++; } # skip to non-blank line elsif ($pstate == 3) { next if /^\s*$/; chomp; $desc = $_; &shortlog_entry($author, $desc); $pstate = 1; } else { die "invalid parse state $pstate"; } } &shortlog_output; exit(0); sub shortlog_entry($$) { my ($tmp_author, $tmp_desc) = @_; $tmp_desc =~ s#/pub/scm/linux/kernel/git/#/.../#g; $tmp_desc =~ s#\[PATCH\] ##g; $tmp_desc =~ s#^\s+##g; if (exists $map{$tmp_author}) { # grab ref my $obj = $map{$tmp_author}; # add desc to array push(@$obj, $tmp_desc); } else { # create new array, containing 1 item my @arr = ($tmp_desc); # store ref to array $map{$tmp_author} = \@arr; } } sub shortlog_output { my ($obj); foreach $author (sort keys %map) { print "$author:\n"; $obj = $map{$author}; foreach $desc (@$obj) { print " $desc\n"; } print "\n"; } }