Displaying the browser data

The browser that is used to access the website is contained within the log file in field 12. It may be interesting to display the list of browsers used to access your site. The following code will assist you in displaying the list of accesses by the reported browser:

{ browser[$12]++ } 
END { 
    for ( b in browser ) 
        print b, " has accessed ", browser[b], " times." 
    } 

You can see how we can create little plugins to awk with these files and adjust the field and array names to suit. The output is shown in the following screenshot:

Interestingly, we see that Mozilla 4 and 5 make up the majority of the requesting client. ...

Get Mastering Linux Shell Scripting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.