in reply to A pretty simple perl script..

You wanted simple so this may give you some ideas:
#!/usr/bin/perl use warnings; use strict; my $LOGDIR = '/hlds/cstrike/logs'; my $USERS = '/hlds/cstrike/addons/adminmod/config/users.ini'; my $search = qr/\bconnected, address\b/; my @users = do { open my $U, $USERS or die "cannot open $USERS:$!"; local $/; <$U> =~ /^[^:]+/mg; }; print "search:@users\n"; my $user_pattern = qr/\b(@{[ join '|', map "\Q$_", reverse sort @users ]})\b/; my %R; @ARGV = <$LOGDIR/*.log>; while ( <> ) { next unless / (\d\d)\D+(\d\d)\D+(\d{4})\D+(\d\d)\D+(\d\d)\D+(\d\d): .+? $user_pattern .+? $search /x; @{ $R{ $7 } }{ qw/date line/ } = ( "$3$1$2$4$5$6", $_ ) if not exists $R{ $7 }{ date } or $R{ $7 }{ date } lt "$3$1$2$4$5$6"; } print "--------------------------\n", sort map $_->{ line }, values %R; __END__

Replies are listed 'Best First'.
Re^2: A pretty simple perl script..
by xnd (Initiate) on Mar 31, 2006 at 09:00 UTC
    Thank you for your reply!
    When i run that code, it prints search: names to search and that's all. It doesn't print anything else :|
    Thanks!
      When I tested it on the data that you provided it printed all the lines that matched the user names.