CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced: Re: [cuboidgraphix] Help Parsing a line please.: Edit Log



KevinR
Veteran


Jan 14, 2009, 2:07 PM


Views: 5373
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:


Code
use Text::ParseWords; 
while (<DATA>) {
my @words = &quotewords('\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)


Edit Log:
Post edited by KevinR (Veteran) on Jan 14, 2009, 2:08 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives