#!/usr/local/bin/perl while (<>) { next unless /pppd/; ($d,$h,$m,$s) = /^(... ..) (..):(..):(..)/ if /Connect:/; next unless /Connection terminated/; ($D,$H,$M,$S) = /^(... ..) (..):(..):(..)/; $w{$d} = $w{$d} || ('Sun','Mon','Tue','Wed','Thu','Fri','Sat') [`date -d"$d" +%w`]; print "$w{$d} $d $h:$m - $H:$M"; $H -= $h; $H += 24 if $H < 0; $M -= $m; $S -= $s; $T = $H*3600+$M*60+$S; $T = 0 if $T < 0; $H = int ($T/3600); $S = $T % 3600 ; $M = sprintf ("%04.01f", $S / 60); print " ($H:$M)\n"; }