my-mnag0:/etc/logwatch/scripts/services # more my-report perl -we '@type=("Empty","Run Lvl","Boot","New Time","Old Time","Init","Login","Normal","Term","Account");$recs = ""; while (<>) {$r ecs .= $_};foreach (split(/(.{384})/s,$recs)) {next if length($_) == 0;my ($type,$pid,$line,$inittab,$user,$host,$t1,$t2,$t3,$t4,$t5 ) = $_ =~/(.{4})(.{4})(.{32})(.{4})(.{32})(.{256})(.{4})(.{4})(.{4})(.{4})(.{4})/s;if (defined $line && $line =~ /\w/) {$line =~ s/\ x00+//g;$host =~ s/\x00+//g;$user =~ s/\x00+//g;printf("%s %-8s %-12s %10s %-45s \n",scalar(gmtime(unpack("I4",$t3))),$type[unpack(" I4",$type)],$user,$line,$host)}}printf"\n"' < /var/log/wtmp my-mnag0:/etc/logwatch/scripts/services # #### my-mnag0:/etc/logwatch/scripts/services # ./my-report | more Fri Dec 18 22:17:17 2009 Login LOGIN tty1 Fri Dec 18 22:17:17 2009 Login LOGIN tty2 Fri Dec 18 22:17:17 2009 Login LOGIN tty3 ... #### --------------------- wmtp logs Begin ------------------------ String found where operator expected at /etc/logwatch/scripts/services/my-report line 1, at end of line (Do you need to predeclare we?) Warning: Use of "log" without parentheses is ambiguous at /etc/logwatch/scripts/services/my-report line 1. syntax error at /etc/logwatch/scripts/services/my-report line 1, next token ??? Search pattern not terminated at /etc/logwatch/scripts/services/my-report line 1. ---------------------- wmtp logs End -------------------------