#!/usr/bin/perl use strict; use warnings; die "$0: Usage: $0\n" if @ARGV; my %clients; { open(P4CLIENTS, "p4 -ztag clients |"); my $client; while() { chomp; $client = $_ if s/^\.\.\. client //; if (defined($client) && s/^\.\.\. Access //) { $clients{$client} = $_; undef $client; } } close(P4CLIENTS); } sub by_date { return $clients{$a} <=> $clients{$b}; } foreach (sort by_date keys %clients) { my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($clients{$_}); printf "%4d/%02d/%02d %02d:%02d:%02d %s\n", 1900+$year, $mon+1, $mday, $hour, $min, $sec, $_; }