We have already had a preview of how we can use awk to view the logs files from the Apache web server; however, we will now move onto our demonstration file that has a greater and more varied content.
Having seen how we can display the date, we should perhaps look at how we print entries from just one day. To do this, we can use the match operator in
awk. This is denoted by the tilde or squiggly line, if you prefer. As we only need the date element, there is no need for us to use both the date and time-zone field. The following command shows how to print entries from 10th September 2014:
$ awk ' ( $4 ~ /10\/Sep\/2014/ ) ' access.log
For completeness, this command and partial output is shown ...