Exercise: parse variable width fields

In this log file I got from some company, there are rows in which the first 16 and last 16 characters describe some kind of an addresses while everything in between describes several commands.

Each command is built up by a leading character (A, B, C, D, etc) and a number of digits. The number of digits depend on the leading character.

In this exercise we need to split up the data to commands and count how many times each command type was given.

examples/data/variable_width_fields.log

1234567890123456A001B0002D00004C0000051234567890123456
1234567890123456A001A002D00004C0000051234567890123456

Tools

Solutions