Re: parsing a tree like structure
- From: yitzle@xxxxxxxxxxxxxxxxxxxxx (Yitzle)
- Date: Thu, 26 Jun 2008 12:51:26 -0400
On Thu, Jun 26, 2008 at 9:57 AM, Pat Rice <patrick.j.rice@xxxxxxxxx> wrote:
Hi all
I'm wondering if there is a nice way to parse this data, as in is
there any module that could handle this type of data, as in the was it
is presented? so that I can repeat is itn a tree like structure in
HTML ?
so I can pic out the tree like structure and replicate it in some way
so that I can put it in an array or into a database ?? so i could pick
out the data I want.
\==+Interface :
|----Link State.........................................Down
\==+SCSI Interface :
|----Name............................................vmhba1
|----Console Name....................................scsi1
|----Queue Depth.....................................4096
\==+PCI Device :
|----Bus..........................................0x0b
|----Slot.........................................0x00
|----Function.....................................0x00
\==+Scsi Stats :
|----Commands.....................................48632378
|----Blocks Read..................................1862894689
|----Blocks Written...............................858120919
|----Aborts.......................................0
Thanks in advance
Pat
I'm thinking of representing each node as a hash of hashes... By
counting the number of leading spaces you can check if the level
changed. For lines starting ' +\|---' you add an element storing the
key/value and for lines starting with a \==+ you change the current
node to a new node.
Needs some work... This makes me think of my C course.
.
- References:
- parsing a tree like structure
- From: Pat Rice
- parsing a tree like structure
- Prev by Date: Re: how to implement this with perl
- Next by Date: Re: parsing a tree like structure
- Previous by thread: Re: parsing a tree like structure
- Next by thread: Re: parsing a tree like structure
- Index(es):
Relevant Pages
|