oldclients.awk
Generated on Tue Dec 05 17:39:06 Eastern Standard Time 2006 from oldclients.awk
# Program : OLDCLIENT.AWK
# Purpose : Extract old clients from GWCLIENTID.CSV, sort by location
# Author : Bob Jonkman
# Date : 9 June 2005
# Modified : 26 October 2006 - Added "Access Mode"
BEGIN { QUOTE = "\"" ;
COMMA = ","
QCQ = QUOTE COMMA QUOTE ;
FIELD_DELIMITER = QUOTE ;
FIELD_SEPARATOR = COMMA ;
FS = COMMA ;
ORS = "" ;
print("Network Location,GroupWise User ID,User IP Address,User Platform,GroupWise Client Release,Client Release Date,Login Name,BU,Postoffice,Access Mode\n") ;
}
(NR==1) { numfields = parsecsv($0,header)
#for (i in header)
for (i=1; i<=numfields; i++)
{
field[header[i]] = i ;
# print("#####DEBUG##### i= " i, header[i] "\n") ;
}
}
($0 == "=====") { nextfile;
}
(FNR!=1) { parsecsv($0,record)
# print("\n##### DEBUG ##### NR= " NR " $0= " $0 ) ;
# for(i=1; i<=numfields; i++) print("\n##### DEBUG ##### i= " i " record[i]= " record[i]) ;
# print("\n##### DEBUG ##### GroupWise Client Release= >" record[field["GroupWise Client Release"]] "< ", record[field["GroupWise Client Release"]] >= CURRENTRELEASE);
if (record[field["GroupWise Client Release"]] >= CURRENTRELEASE)
next ;
# print("\n##### DEBUG ##### Proxied User ID= >" record[field["Proxied User ID"]] "<");
# if (record[field["Proxied User ID"]] != "") # Do not record proxies (disabled; people who are proxied aren't necessarily logged in as themselves as well)
# next ;
# print("\n##### DEBUG ##### User Platform= >" record[field["User Platform"]] "<");
if ((tolower(substr(record[field["User Platform"]],1,3)) == "gwi") ||
(tolower(substr(record[field["User Platform"]],1,3)) == "web") ||
(tolower(substr(record[field["User Platform"]],1,3)) == "dos") ||
(tolower(substr(record[field["Access Mode"]],1,3)) == "bat")) # Do not record system clients
next ;
total++ ;
# print("\n##### DEBUG ##### Tada!");
print( printcsv(record[field["Network Location"]]) ) | "sort" ;
print("," printcsv(record[field["GroupWise User ID"]]) ) | "sort" ;
print("," printcsv(record[field["User IP Address"]]) ) | "sort" ;
print("," printcsv(record[field["User Platform"]]) ) | "sort" ;
print("," printcsv(record[field["GroupWise Client Release"]])) | "sort" ;
print("," printcsv(record[field["Client Release Date"]]) ) | "sort" ;
print("," printcsv(record[field["Login Name"]]) ) | "sort" ;
print("," printcsv(record[field["BU"]]) ) | "sort" ;
print("," printcsv(record[field["Postoffice"]]) ) | "sort" ;
print("," printcsv(record[field["Access Mode]]) ) | "sort" ;
print("\n") | "sort" ;
}
END { print("=====\n") ;
print("Total," total "\n");
print("Current Release," CURRENTRELEASE "\n") ;
}
# EOF: OLDCLIENT.AWK
1 files processed.