Hello
I am trying to figure out a script which could group a log file by user names. I worked with awk command and I could trim the log file to:
<USER: John Frisbie > /* Thu Aug 06 2009 15:11:45.7974 */ FLOAT GRANT WRITE John Frisbie (500 of 3005 write)
<USER: Shawn Sanders > /* Thu Aug 06 2009 15:11:49.7695 */ FLOAT GRANT WRITE Shawn Sanders (552 of 3004 write)
<USER: John Frisbie > /* Thu Aug 06 2009 15:12:02.3639 */ LOGIN John Frisbie
But I need to have the output like:
Users
John Frisbie
FLOAT GRANT WRITE Thu Aug 06 2009 15:11:45.7974 (500 of 3005 write)
LOGIN Thu Aug 06 2009 15:12:02.3639
Shawn Sanders
FLOAT GRANT WRITE Thu Aug 06 2009 15:11:49.7695 (552 of 3004 write)
I have tried commands like:
awk 'BEGIN{print "Users"} {a[$2]=a[$2]+[$3]}END{for (i in a) printf(i,a, $5,$6,$7,$8,$9,$11,$12,$13,$14,$15]} ' log
or
User= $1,$2
awk '{if ($1,$2 == "User")print $5,$6,$7,$8,$9,$11,$12,$13,$14,$15}' log
But after several results it seems that I am completely lost. I am not sure how can I group the user ids by name and then display the user name only once and below of it all the information associated .
If you could please provide your advice I will appreciate it.
Thanks!