A more advanced example

In this section, you will learn how to match a date and time string as found in the log files of an Apache web server. To make things even more interesting, you will also learn how to change the date and time format of the log file into a different format. Once again, this requires reading the Apache log file, which is a plain text file, line by line.

The name of the command-line utility is changeDT.go and it will be presented in five parts. Note that changeDT.go is an improved version of the timeDate.go utility presented in Chapter 3, Working with Basic Go Data Types, not only because it gets its data from an external file, but also because changeDT.go uses two regular expressions and therefore it is able to match ...

Get Mastering Go - Second Edition 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.