Code Files

reclaimed.awk

Generated on Tue Dec 05 17:39:05 Eastern Standard Time 2006 from reclaimed.awk


# Program	: RECLAIMED.AWK	
# Purpose	: Parse through GWCHECK Structure logs, total up Bytes Reclaimed
# Author	: Bob Jonkman <bjonkman@sobac.com>

# Copyright 2008 Bob Jonkman and/or SOBAC Microcomputer Services

#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Date		: 9 February 2005


BEGIN			{ 	OFS = "," ;
				Mebi = 1024*1024 ;   # http://en.wikipedia.org/wiki/Binary_prefix
				print("From the GWCHECK.LOG file") ;
			}

/Processed on/			# print date & time of processing

/Path to PO/			# print 

/Post Office=/		{	print($0) ;		# print PO name	
			}
	
/Action       = Expire/	{	print($0) ;
				correctfile = 1 ;
				count = "user" ;
			}

/Verify /  		{	print($0) ;
				if ($3 == "Structure")
					correctfile = 1 ;
			}

/options are consistent/ {	print("\n") ;
				print("Bytes Reclaimed,ObjectID,database") ;
			}	
	

/Checking message/	{	count = "message" ; 
				ObjectID = $4 ; 	# Message DB name	
			}

/Checking user/		{	count = "user" ;	
				ObjectID = $4 ;		# User name
			}

/Reducing database/	{	pathfields = split($3,db,"\\");				
				database = db[pathfields] ;
			}
			

/bytes reclaimed/	{ 	reclaimed[count] += $1 ; # Conveniently, the byte count is in the first field
				printf("%14i,%s,%s\n", $1, ObjectID,database)  | "sort /R"  ;
			}

END		{	if(!correctfile)
			{	print("\n\n" FILENAME " is not a GWCHECK Structure log file!") ;
				print(FILENAME " is not a GWCHECK Structure log file!") > "/dev/stderr" ;
			}	
			else 
			{
		
				print("\n") ;
				printf("%15i,Total Message Bytes Reclaimed (%.2f MiBytes)\n", reclaimed["message"], reclaimed["message"]/Mebi);
				printf("%15i,Total User Bytes Reclaimed (%.2f MiBytes)\n", reclaimed["user"], reclaimed["user"]/Mebi) ;
				total = reclaimed["message"] + reclaimed["user"] ;
				printf("\n%15i,Total Bytes Reclaimed (%.2f MiBytes)\n", total, total/Mebi );
			}
		}

# EOF: RECLAIMED.AWK
   

1 files processed.