Need help in shell Scripting to display a output from a command

Please find my below requirement and see if you can help me on this. I am looking for a shell script which can provide me the below output.

Manuall steps which i am doing now

1) First I source the File

$ . ./WC_env.sh

2) Execute the command

$  /app/oracle/product/mos/bin/mosotl -url test.domain.com:7001 -p xxxxx -q oracle.mos.xns:Location=Server_1,type=Control -o status

3) Output from the above command

oracle.mos.xns:Location=Server_1,type=Control {
}
status =>
EmailService: #0.LOW STOPPED; #1.LOW RUNNING; #2.LOW RUNNING; #3.LOW RUNNING; #0.HIGH RUNNING; #1.HIGH RUNNING; #2.HIGH RUNNING; #3.HIGH RUNNING; ,
SmsService: #0.LOW RUNNING; #1.LOW RUNNING; #2.LOW RUNNING; #3.LOW RUNNING; #0.HIGH RUNNING; #1.HIGH RUNNING; #2.HIGH RUNNING; #3.HIGH RUNNING; ,
ImService: #0.LOW STOPPED; #1.LOW STOPPED; #2.LOW STOPPED; #3.LOW STOPPED; #0.HIGH STOPPED; #1.HIGH STOPPED; #2.HIGH STOPPED; #3.HIGH STOPPED; ,
EmailToSmsService: #0.LOW RUNNING; #1.LOW RUNNING; #2.LOW RUNNING; #3.LOW RUNNING; #0.HIGH STOPPED; #1.HIGH RUNNING; #2.HIGH RUNNING; #3.HIGH RUNNING; ,

4) If the status is showing a STOPPED in any of the 4 services in each row I should be getting the below output.

Email Service is not working on Server_1
SmsService is working on Server_1
ImService is not working on Server_1
EmailToSmsService is not working on Server_1

Other Case where all the 4 services are showing running in each row.

EmailService: #0.LOW RUNNING; #1.LOW RUNNING; #2.LOW RUNNING; #3.LOW RUNNING; #0.HIGH RUNNING; #1.HIGH RUNNING; #2.HIGH RUNNING; #3.HIGH RUNNING; ,
SmsService: #0.LOW RUNNING; #1.LOW RUNNING; #2.LOW RUNNING; #3.LOW RUNNING; #0.HIGH RUNNING; #1.HIGH RUNNING; #2.HIGH RUNNING; #3.HIGH RUNNING; ,
ImService: #0.LOW RUNNING; #1.LOW RUNNING; #2.LOW RUNNING; #3.LOW RUNNING; #0.HIGH RUNNING; #1.HIGH RUNNING; #2.HIGH RUNNING; #3.HIGH RUNNING; ,
EmailToSmsService: #0.LOW RUNNING; #1.LOW RUNNING; #2.LOW RUNNING; #3.LOW RUNNING; #0.HIGH RUNNING; #1.HIGH RUNNING; #2.HIGH RUNNING; #3.HIGH RUNNING
Email Service,SmsService,ImService and EmailToSmsService is working on Server_1

Welcome to the forum sudheshpn@gmail.
Did you try something? Where are you stuck?

Welcome sudheshpn@gmail

Is that really your e-mail address? Prepare to be spammed by people that search the web for visible addresses. Perhaps you could ask for it to be changed
Post Here to Contact Site Administrators and Moderators

A few questions to get us started:-

  • What have you tried so far?
  • What output or errors are you getting?
  • What Operating System and version are you using?
  • How do we interpret the output? If any item is listed as STOPPED on a line perhaps or all?
  • Have you read the pages for grep?
  • What are your preferred tools? ksh, bash, csh, awk ?

Most importantly, What have you tried so far?

You will get better responses if you can demonstrate effort in the first place and code reduced to the smallest point where you can reproduce the problem.

Regards,
Robin