1#!/bin/awk
2# Quite fast log format converter (eggdrop->mirc)
3# For those channel stat generators that accept only mirc log format
4# use: awk -f egg2mirc.awk channel.log > mircformat.log
5#
6# Gandalf the Grey <gandalf@irc.pl>
7# "The Song Remains The Same" - Led Zeppelin
8#
9/\[..\:..\] <.+>/ {	print $0
10			next }
11/\[..\:..\] Action:/ { 	$2="*"
12			print $0
13			next }
14/\[..\:..\] .+ (.+) joined #/	{	print $1 " *** " $2 " " $3 " has " $4 " " substr($5,1,length($5)-1)
15					next }
16/\[..\:..\] .+ (.+) left #/	{	print $1 " *** " $2 " " $3 " has " $4 " " substr($5,1,length($5)-1)
17					next }
18/\[..\:..\] .+ (.+) left irc/	{	print $1 " *** " $2 " " $3 " Quit (" $6 "...)"
19					next }
20/\[..\:..\] .+ kicked from #/	{	print $1 " *** " $2 " was " $3 " by " substr($7,1,length($7)-1) " (" $8 "...)"
21					next }
22/\[..\:..\] #.+\: mode change /	{ if (index($NF,"!")!=0) print $1 " *** " substr($NF,1,index($NF,"!")-1) " sets mode: " substr($0,index($0,"'")+1,length($0)-length($(NF))-index($0,"'")-5)
23					else print $1 " *** " $NF " sets mode: " substr($0,index($0,"'")+1,length($0)-length($(NF))-index($0,"'")-5)}
24