Question : regex matching - multiple lines

I've been scratching my head a bit on this one (regex isn't my strong suit).  I am assigning output from a executable to a variable in my script as so:

data=`$XM list -l | sed s/\(//g | sed s/\)//g`; #strip parens

I want to pull out lines matching:

domid
cpu_time

from $data, but I can't figure out exactly how to go about that via a regex.  As the input is not coming in via a file, I don't know how to grab one line at a time and I can't save the output temporarily to a file as that is one of my restrictions.  There are multiple occurrences of the below block in the output I need to parse and I don't know beforehand how many there will be.

How can I take this info and parse it into an array holding the tokens?  The tokens being defined as the line beginning with domid and the line beginning with cpu_time.  I'm under the impression that bash does not have multi-dimensional arrays so I have to store these in 2 arrays, right?

(domain
    (domid 14)
    (uuid 04500ade-a703-23b7-e6f8-31e41c588c00)
    (vcpus 1)
    (cpu_weight 1.0)
    (memory 160)
    (shadow_memory 0)
    (maxmem 160)
    (features )
    (name sampledomain.com)
    (on_poweroff destroy)
    (on_reboot restart)
    (on_crash destroy)
    (image
        (linux
            (kernel /home/users/sampledomain.com/linux)
            (root '/dev/xvda1 ro')
        )
    )
    (device
        (vif
            (backend 0)
            (script vif-bridge)
            (bridge xen-br0)
            (mac aa:00:79:64:33:ce)
        )
    )
    (device
        (vbd
            (backend 0)
            (dev xvda1:disk)
            (uname file:/home/users/sampledomain.com/fc6-1.ext3)
            (mode w)
        )
    )
    (device
        (vbd
            (backend 0)
            (dev xvda9:disk)
            (uname file:/home/users/sampledomain.com/swapfs.swp)
            (mode w)
        )
    )
    (state -b----)
    (shutdown_reason poweroff)
    (cpu_time 20205.5002826)
    (online_vcpus 1)
    (up_time 3047639.48897)
    (start_time 1171852894.06)
)

Answer : regex matching - multiple lines

dom=(`$XM list -l | sed s/\(//g | sed s/\)//g | grep domid`) does stuff the matching portions into an array where each element will hold a single matching entry.
echo ${dom[0]} would show the first entry ${dom[*]} would show all ig them
Random Solutions  
 
programming4us programming4us