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:
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?
(root '/dev/xvda1 ro')