LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Shell Script Parser (https://www.linuxquestions.org/questions/programming-9/shell-script-parser-905134/)

nodopro 09-26-2011 06:16 PM

Shell Script Parser
 
How do I parse out the fatal error and accumulate to total errors if I have a string like below. So the total errors will be 5.

"TEST 1: 3 Fatal Errors TEST 2: 2 Fatal Errors TEST 3: 0 Fatal Errors"

Thanks in advance.

grail 09-26-2011 07:20 PM

What have you tried? You could parse that line with awk, bash or one of several languages.

theFreethinker 09-27-2011 07:28 AM

If the format is always the same, awk sound perfect to me.


All times are GMT -5. The time now is 02:34 AM.