I have a variable that can hold one of the followings strings:
"ERROR(1): disk number (27) crashed at (11:03)"
"WARNING(1): system is rebooting"
These strings are output generated from a script I run. As you can see, the first word is the status itself, in the forst parenthesis (before the colon) is the exit status, that not always exist, and after the colon is a string with variables in parenthesis.
I need to extract the status, exit status (if exists), and variables (if exists), and print to display a new string with placeholders for the variables taken from the output above.
How can I easily extract all I need from the string outputed by the script (a regexp or something), I need at the end an array holding the status followed by the exit status in the first entry (for example: OFF, ERROR2, WARNING1), and the variables in the next entries, for example:
@neededResultEx1 = ('OFF');
@neededResultEx2 = ('SUCCESS', 'abc');
@neededResultEx3 = ('ERROR1', '27', '11:03');