back to log parsing of coursethe previous example could easily have been coded using couple integer variables and calling +increment on them let' look at second example where coroutines actually save us some code this example is somewhat simplified (for pedagogical reasonsversion of problem had to solve in my real job the fact that it logically follows from the earlier discussions about processing log file is completely serendipitousthose examples were written for the first edition of this bookwhereas this problem came up four years laterthe linux kernel log contains lines that look somewhatbut not quite completelyunlike thisunrelated log messages sd : : : attached disk drive unrelated log messages sd : : : (serial=zz unrelated log messages sd : : : [sdaoptions unrelated log messages xfs error [sdaunrelated log messages sd : : : attached disk drive unrelated log messages sd : : : (serial=zz unrelated log messages sd : : : [sdboptions unrelated log messages sd : : : attached disk drive unrelated log messages sd : : : (serial=ww unrelated log messages sd : : : [sdcoptions unrelated log messages xfs error [sdcunrelated log messages there are whole bunch of interspersed kernel log messagessome of which pertain to hard disks the hard disk messages might be interspersed with other messagesbut they occur in predictable format and orderin which specific drive with known serial number is associated with bus identifier (such as : : : )and block device identifier (such as sdais associated with that bus finallyif the drive has corrupt filesystemit might fail with an xfs error