Skip to content

Instantly share code, notes, and snippets.

@yath
Created September 9, 2011 08:40
Show Gist options
  • Save yath/1205777 to your computer and use it in GitHub Desktop.
Save yath/1205777 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use warnings;
use 5.012.0;
my $dir;
my $file;
my %x;
while (<>) {
chomp;
if (/^$/) {
next;
} elsif (/^([^ ].*)/) {
$dir = $1;
} elsif (/^ ([^ ].*)/) {
$file = $1;
} elsif (/^ \[([OT])\] (.*)/) {
push @{$x{"res/$dir"}->{$1}}, $2;
} else {
die "Unknown line: $_";
}
}
foreach my $file (sort keys %x) {
foreach my $type (sort keys %{$x{$file}}) {
local $, = "\t";
say $file, $type, join("|", map { qq("$_") } @{$x{$file}->{$type}});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment