Advertisement

01.29.2008 at 11:24AM PST, ID: 23120476
[x]
Attachment Details

How to split log file lines into array with curly brackets and quotes as the delimiter

Asked by W00dyW00d in Perl Programming Language

Tags:

I have a log file that uses this type of format.  The there is a bunch of different line format this one example is from LINE_TYPE:  it is split by either { } or " " and sometimes there is { {} {} }, curly inside of curly.  I want to split all of them and put them into an array or maybe a hash with their variable name as a reference.  I can change the variable reference parts but I cant change the log file. This is just a short example most lines can get to a hundred variables.

LOG LINE:
Tue Jan 29 06:23:49 2008 LINE_TYPE: {test test} {3} {test} { {test1} {test2} } {files.doc} "testing again"

Then I have a variable that tells how to process "LINE_TYPE"
"LINE_TYPE:"  "%num1 %num2 %num3 %num4 %num5 %num6"


Thanks for the help!Start Free Trial
[+][-]01.29.2008 at 11:34AM PST, ID: 20771285

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.29.2008 at 11:43AM PST, ID: 20771399

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.29.2008 at 11:45AM PST, ID: 20771414

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.29.2008 at 11:52AM PST, ID: 20771483

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Perl Programming Language
Tags: Perl
Sign Up Now!
Solution Provided By: ozo
Participating Experts: 2
Solution Grade: A
 
 
[+][-]01.29.2008 at 12:00PM PST, ID: 20771573

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.29.2008 at 12:23PM PST, ID: 20771828

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]01.29.2008 at 12:32PM PST, ID: 20771937

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.29.2008 at 12:48PM PST, ID: 20772097

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628