[LCP] tokening strings in C?

Zach Uram netrek at gmail.com
Wed Jan 7 04:19:23 EST 2009


Hi everyone!

I wish to parse a game log file and tokenize the parts I want and then
save them to an HTML file. Here are some typical lines from the log
file:

Tue Dec 23 21:29:47 2008
09:29:47 Kathy->ALL Robot Annihilator (R3) was ejected to make room
for a human player.
09:29:47  R3->ALL  Ensign Annihilator (R3) leaving game (Pre_T_Robot!@localhost)
09:29:47  R6->ALL  Flt. Capt. hyperyoda is now R6 (ubuntu@=66.207.132.65)
09:29:47  R6->R6   @2.5.0.0
09:29:47 Kathy->ALL Resetting for real T-mode!
09:29:47 Kathy->ALL Restoring previous T-mode galaxy.
09:29:48 GOD->ALL  Diplomat insults foreign emperor's mother and
fighting breaks out!
09:29:48 GOD->ALL  Flt. Capt. hyperyoda is not using a trusted client
09:29:56 GOD->ALL Idled [CA] (R7) was kill   1.00 for guest [CA] (F2) [photon]
09:29:57 GOD->ALL guest [CA] (F2) was kill   1.10 for Idled [CA] (R7) [explos]
09:30:06  R6->ROM Bombing org @ 8
09:30:13  R6->R1   @
09:30:14 GOD->R6   R1 is NCC-Voyager
(play.netrek.org at cpe-24-174-149-36.satx.res.rr.com)
09:30:14 GOD->R6   R1 at 24.174.149.36 (IP)
09:30:15  R6->R1   t mode!

I am mainly interested in coversations between human players: a->b
Such as above: 09:30:15  R6->R1   t mode!
Also I want to preserve the time code.
Messages that are "GOD->ALL" i wish to save in a different HTML file.

Some messages may have weird characters like "%" in them so how I handle these?

Anyone have any ideas how to do this and even better some code to get
me started?

Zach



More information about the linuxCprogramming mailing list