I need to parse the following output :-
|------------------------------|-----------------|----------------------------------------|--------------------|------------| | Assembly name | User name | Path | Start Time | State | |----------127.0.0.1-----------|-----------------|------Shell version 1.2.1-13-09-27------|--------------------|------------| |ng40core2 |ng40 |/home/regress/ng40core2 |2013-10-07 16:55:52 |Running | |ng40core1 |ng40 |/home/regress/ng40core1 |2013-10-07 16:53:54 |Running | |------------------------------|-----------------|----------------------------------------|--------------------|------------|
There can be multiple entries with different versions of ng40core in this output.
I have written regex for single line,
regex_list = ['\s*',
'\S+\s*',
'\S+\s+Assembly\s+name\s+\S+\s+User\s+name\s+\S+\s+Path\s+\S+\s+Start\s+Time\s+\S+\s+State\s+\S+\s*',
'\|\S+\d+\.\d+\.\d+\.\d+\S+Shell\s+version\s+.*\s*',
'\|(?P<ng40core_instance>\S+)\s+\|(?P<user_name>\S+)\s+\|(?P<path>\S+)\s+\|(?P<start_time>\d+\-\d+\-\d+\s+\d+:\d+:\d+)\s+\|(?P<state>\w+)\s+\|\s*']
I want to get multiple values for a single key.
For "ng40core2" - I need username,path,start-time and state
Same way for "ng40core1" - I need username,path,start-time and state.
It will be really helpful if you can suggest a way to achieve this.