in reply to Pointers to formatting output

Update: It looks that the OP doesn't want grouping by category ; he wants prettyfication of the lines themselves (see BrowserUk's comment above). The rest of my post below is moot.

(hope I understand your question correctly)

If a regexp like m/^(.+:)\s*$/ matches a category headline, and you have a logfile like:

Project status: project created DB update: database initialized Project status: world domintation ahead DB update: database low on memory DB update: database borks ; all data lost Project status: shattered dreams Project status: starting all over again

then the following program will give you a starting point:

#!/usr/bin/perl my %cats; my $cat = "_UNDEFINED:"; open my $fh, '<', 'categories.txt' or die; while (<$fh>) { next if m/^\s*$/; #skip blank lines if (m/^(.+:)\s*$/) { $cat = $1; next; } $cats{$cat} .= ">> $_"; } for (sort keys %cats) { print "$_\n"; print $cats{$_}; } close $fh;

The output is:

DB update: >> database initialized >> database low on memory >> database borks ; all data lost Project status: >> project created >> world domintation ahead >> shattered dreams >> starting all over again