[printer_queue1]
[user1]
5 jobs - 10 pages total
[user2]
2 jobs - 1 page total
[printer_queue2]
[userx]
100 jobs - 300 pages total
####
use strict;
use warnings;
use diagnostics;
use Data::Dumper;
open PAGELOG, "page_log" or
die "unable to open pagelog: $!\n";
my %unique=();
my (@array, @queues);
my @LOGLINES=map { split /^(.*)$/, $_ } ;
# Get all unique queue names
for (@LOGLINES)
{
next unless /^\w+.*/;
my $queue=$1 if /^(\w+)\s.*/;
push (@queues, $queue) unless $unique{$queue}++;
}
for my $line(@LOGLINES)
{
chomp ($line);
next unless ( $line =~ m/^\w+.*/ );
for my $queue (@queues)
{
chomp ($queue);
next unless ($queue =~ m/\w+/);
if (grep $queue, $line)
{
s/$1//g if ($line =~ m/.*(\[.*\])\s.*/);
s/$1/ /g if ($line =~ m/^\w.*(\s\s).*/);
my ($printer, $user, $jid, $page, $copies, $billing, $host) =
split(/ /, $line);
push ( @array,[$queue, $user, $jid]) unless $unique{$jid}++;
}
}
}
print Dumper @array;
####
s/$1/ /g if ($line =~ m/^\w.*(\s\s).*/);
####
R_NETADMIN_NB apache 8 [22/Apr/2005:11:19:55 -0400] 1 1 - localhost
R_NETADMIN_NB apache 9 [22/Apr/2005:12:53:19 -0400] 1 1 - localhost
R_SPARE root 15 [25/Apr/2005:13:12:58 -0400] 1 1 - localhost
R_SPARE root 15 [25/Apr/2005:13:15:00 -0400] 1 1 - localhost
R_NETADMIN_NB apache 13 [25/Apr/2005:14:47:15 -0400] 1 1 - localhost
R_SPARE root 15 [25/Apr/2005:14:47:27 -0400] 1 1 - localhost
RSPARE root 16 [25/Apr/2005:14:53:52 -0400] 1 1 - localhost
RSPARE_NB root 17 [25/Apr/2005:14:57:41 -0400] 1 1 - localhost
RSPARE root 16 [25/Apr/2005:14:58:07 -0400] 1 1 - localhost
R_NETADMIN_NB root 18 [25/Apr/2005:14:59:08 -0400] 1 1 - localhost
R_NETADMIN_NB root 19 [25/Apr/2005:15:00:37 -0400] 1 1 - localhost
Y_NETADMIN root 20 [25/Apr/2005:15:13:16 -0400] 1 1 - localhost
Y_NETADMIN root 20 [25/Apr/2005:15:13:18 -0400] 1 1 - localhost
Y_NETADMIN_NB root 21 [25/Apr/2005:15:14:21 -0400] 1 1 - localhost