|Problems? Is your data what you think it is?|
Turning regex capture group variables into arrays, then counting the number of objects in the arrayby Djay (Novice)
|on Dec 04, 2018 at 11:51 UTC||Need Help??|
Djay has asked for the wisdom of the Perl Monks concerning the following question:
I've been working on building a small script, equivalent to a Powershell Script I've already written (but this time for Linux), which essentially takes the output of a command, regex's it, chucks all the capture groups into separate arrays and counts the number of objects in each array. This is reasonably complicated (for me) in Powershell, but can be accomplished through clever use of hashtables.
I am a complete and utter Perl novice, with literally no experience in the language. I've tried to do the above with Bash but it seems so limited, and my Regex is using PCRE. I've tried using the Perl one liner but I cant seem to call the capture group variables into an array in bash to count them.
Below is a sample output from the command
I'm terrible with HTML so I don't know how to fix the text wrapping in the above output
Below is my regex (which works in Powershell)
In the Script I have for windows, each capture group corresponds to the columns on this table, and my script counts the objects within each capture group (thus counting the number of failed, successful, running backups etc.
I have no code written in Perl other than the following (which doesn't work for my purpose and was Frankenstein'd from much googling)
Any help would be greatly appreciated - cheers