LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-26-2011, 06:16 PM   #1
nodopro
Member
 
Registered: Oct 2008
Posts: 48

Rep: Reputation: 16
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.
 
Old 09-26-2011, 07:20 PM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,008

Rep: Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193
What have you tried? You could parse that line with awk, bash or one of several languages.
 
Old 09-27-2011, 07:28 AM   #3
theFreethinker
LQ Newbie
 
Registered: Jul 2011
Location: Tartu, Estonia
Distribution: Ubuntu
Posts: 17

Rep: Reputation: Disabled
If the format is always the same, awk sound perfect to me.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Executing a Shell script with 654 permissions inside another shell script. changusee2k Linux - Newbie 2 06-07-2011 07:58 PM
LXer: Simple Snort Alert Parser Script LXer Syndicated Linux News 0 09-26-2010 12:10 PM
need a text parser script sfaizan Programming 2 07-29-2008 07:48 PM
shell xml parser macushk Linux - Newbie 6 05-03-2008 10:52 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration