
KevinR
Veteran

Jan 14, 2009, 2:07 PM
Views: 4344
|
|
Re: [cuboidgraphix] Help Parsing a line please.
|
|
|
It looks like you can use the core module Text::ParsWords juding by the sample data. Here is an example of how to use it just to tokenize the lines:
use Text::ParseWords; while (<DATA>) { my @words = "ewords('\s+', 0, $_); $i = 0; foreach (@words) { print "$i: <$_>\n"; $i++; } } __DATA__ # 90148 Nak Active "14 Jan 09 00:00:57" "O%:CBS1:BSM1:BSMPerfandUtil1" MINOR "CPU Usage exceeded the Threshold" # 90148 Nak Clear "14 Jan 09 00:07:59" "O%:CBS1:BSM1:BSMPerfandUtil1" MINOR "CPU Usage exceeded the Threshold" # 90148 Ack Clear "14 Jan 09 00:07:59" "O%:CBS1:BSM1:BSMPerfandUtil1" MINOR "CPU Usage exceeded the Threshold" # 1692545 Nak Active "14 Jan 09 01:48:32" "O%:CBS1:Cells1:MC800BTS1029:MCBTSSubsystem1:Root1:CEM2" MINOR "SWERR log threshold exceeded at CEM, please upload the log // [XCEM] SWERR Log" Since your overall goal is unlcear I am not what else to suggest. Are you parsing the file line by line and doing something with the variables right then or are you building a large data set then doing something with the data? -------------------------------------------------
(This post was edited by KevinR on Jan 14, 2009, 2:08 PM)
|