| 1 | /^[0-9]+:/ { |
| 2 | sub(":$", "", $1) |
| 3 | sub(":$", "", $2) |
| 4 | sequence = $1 |
| 5 | interface = $2 |
| 6 | Interfaces[sequence] = interface |
| 7 | } |
| 8 | |
| 9 | /^ +inet [0-9]/ { |
| 10 | sub("/[0-9]+", "", $2) |
| 11 | addr = $2 |
| 12 | Addrs[interface] = addr |
| 13 | } |
| 14 | |
| 15 | /^ +RX: / {transfer_direction = "r"} |
| 16 | /^ +TX: / {transfer_direction = "w"} |
| 17 | |
| 18 | /^ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+ +[0-9]+ *$/ { |
| 19 | io[interface, transfer_direction] = $1; |
| 20 | } |
| 21 | |
| 22 | END { |
| 23 | for (seq=1; seq<=sequence; seq++) { |
| 24 | interface = Interfaces[seq] |
| 25 | label = substr(interface, 1, 1) |
| 26 | addr = Addrs[interface] |
| 27 | if (addr) { |
| 28 | bytes_read = io[interface, "r"] |
| 29 | bytes_written = io[interface, "w"] |
| 30 | } else { |
| 31 | bytes_read = "" |
| 32 | bytes_written = "" |
| 33 | } |
| 34 | output["addr" Kfs interface] = addr |
| 35 | output["bytes_read" Kfs interface] = bytes_read |
| 36 | output["bytes_written" Kfs interface] = bytes_written |
| 37 | } |
| 38 | for (key in output) { |
| 39 | print(key, output[key]) |
| 40 | } |
| 41 | } |