Skip to content

Instantly share code, notes, and snippets.

@yath

yath/alp

Created Sep 9, 2011
Embed
What would you like to do?
#!/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
You can’t perform that action at this time.