Code Files

gwclientid-version-freq.awk

Generated on Tue Dec 05 17:39:06 Eastern Standard Time 2006 from gwclientid-version-freq.awk


# Program    : GWCLIENTID-VERSION-FREQ.AWK
# Purpose    : Parse through file with frequencies, listing meta-frequencies
# Date       : 24 September 2003
# Based on   : FREQSLOT.AWK, 25 October 2002
# 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/>.

# Input format    : Postoffice,GroupWise User ID,NDS Login Name,User IP Address,Login Time,User platform,GroupWise Client Release,Release Date,Net Ordinal


BEGIN    {  FS     = "," ;
            OFS    = "," ;
            SUBSEP = "," ;
            QUOTE  = "\"" ;
            COMMA  = "," ;

            FIELD_DELIMITER = QUOTE ;
            FIELD_SEPARATOR = COMMA ;

            version  = "GroupWise Client Release" ;
            date     = "Client Release Date" ;
            platform = "User Platform" ;

            print(version,date,platform,"Frequency") ;
    }


(FNR==1)    {   numfields = parsecsv($0,headers) ;
                for(i in headers)
                {
#                   print("##### DEBUG ##### i= " i " headers[i]= " headers[i]) ;
                    fieldname[headers[i]] = i ;  # Create inverse header names
                }
}

# Don't count the field headers in the first row... 
(FNR != 1)  {   if($0 == "=====")       # Don't process .CSV footers
                    nextfile ;

                parsecsv($0,record) ;
                freq[printcsv(record[fieldname[version]]),printcsv(record[fieldname[date]]),printcsv(record[fieldname[platform]])]++ ;
}

# end of scanning


# Post-process: print versions and frequencies

END     {   for (i in freq) 
            {
#                print("##### DEBUG ##### i= " i " freq[i]= " freq[i] ) ;
                print(i,freq[i]) | "SORT /R" ;
#               split(i,parts,",") ;
#               printf("%s,%s,%s,%8i\n",printcsv(parts[1]), printcsv(parts[2]), printcsv(parts[3]), freq[i] ) | "sort /r" ;
                total += freq[i];
                count++
             }

            print("=====") 
            print("Unique Versions", count)
            print("Total", total);
    
    }
     

# EOF: GWCLIENTID-VERSION-FREQ.AWK

   

1 files processed.