I’ve got the following excerpt from a logfile, and have to grab everything between ‘NC: ‘ and ‘VL #’ or ‘Total violation level so far #.’ Any thoughts on how I might be able to grab that string given that the length is unknown and there’s no easy delimiter?
11.11.27 14:50:41 [WARNING] NC: elvefromhell failed fight.noswing: Didn’t swing arm. VL 3
11.11.27 14:50:54 [INFO] NC: Jackmac19 failed fight.direction: tried to attack out of sight entity. Total violation level so far 5.
11.11.27 14:51:02 [WARNING] NC: Bugs6968 failed chat.spam: Last sent message "t". VL 1
11.11.27 14:51:26 [WARNING] NC: Convinced failed chat.spam: Last sent message "hi pherce". VL 1
11.11.27 14:51:48 [WARNING] NC: UmbraSprite failed blockbreak.noswing: Didn’t swing arm. VL 2
11.11.27 14:51:59 [INFO] NC: AwayDood failed moving.running.vertical. VL 2
11.11.27 14:52:17 [INFO] NC: AwayDood failed moving.running.vertical. VL 11
11.11.27 14:52:35 [INFO] NC: AwayDood failed moving.running.vertical. VL 11
11.11.27 14:53:06 [WARNING] NC: AwayDood failed blockbreak.noswing: Didn’t swing arm. VL 4
Using a regular expression:
This would operate on one line at a time. It can be made to work on a larger piece of log, but it seems sounder to process the log a line at a time.
See it in action.