#!/bin/bash
#for x in `grep -P -o ".*" out`
cat out | cut -f 2 | uniq -c | sort -gr | while read x
do
command=`echo $x | grep -o "[^ ]\{2,\}$"`
invoc=`echo $x | grep -o "^[0-9]\{1,\}"`
time=0
for z in `grep "\s$command\s" out | tr -s " " "*"`
do
time2=`echo $z | cut -d "*" -f 3`
time3=`date -d "January 1 1970 ${time2} UTC" +%s`
time=`expr $time + $time3`
done
outtime=`date -d "00:00 ${time} seconds" +%T`
echo -e "$command \t $invoc \t $outtime"
done
00:00:01 sshd
00:00:01 sshd
00:00:01 sshd
00:00:02 sshd
00:00:02 sshd
00:00:03 sshd
00:00:03 sshd
00:00:05 sshd
00:00:16 sshd
00:00:00 startkde
00:00:00 startkde
00:00:08 syslogd
00:00:00 tail
00:00:00 tail
00:00:00 udevd
00:00:00 vi
00:00:01 vi
00:00:01 vim
00:00:00 wnck-applet
02:33:05 X
00:00:03 xfs
00:00:00 xinetd
00:00:01 xscreensaver
|