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


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need help in shell Scripting to display a output from a command
# 1  
Old 05-14-2014
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
Code:
$ . ./WC_env.sh

2) Execute the command

Code:
$  /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

Code:
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.

Code:
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.


Code:
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


Code:
Email Service,SmsService,ImService and EmailToSmsService is working on Server_1


Last edited by bartus11; 05-14-2014 at 09:13 AM.. Reason: Please use [code][/code] tags.
# 2  
Old 05-14-2014
Welcome to the forum sudheshpn@gmail.
Did you try something? Where are you stuck?
# 3  
Old 05-14-2014
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to display only the first 5 running process using top in shell scripting?

topfunc() { top } topfunc Here i used the top command inside a function,and i called the function. when executing this bash file i get all the process which are using by the kernel i just want to display only the first 5 running process. is it possible? (7 Replies)
Discussion started by: Meeran Rizvi
7 Replies

2. Shell Programming and Scripting

Please help in populating output in table using shell scripting

Below is my code where i tried using table tag to print out put in table but its not working #!/bin/ksh #] && . ./.profile 2>/dev/null if test -f '.profile'; then . ./.profile; fi; #. .profile LOG_DIR=/app/rpx/jobs/scripts/just/logs sendEmail() { pzCType="$1";... (5 Replies)
Discussion started by: ankit.mca.aaidu
5 Replies

3. Shell Programming and Scripting

Display the First and Last name from a file using shell scripting

I am new to shell scripting and doing a similar thing @ work Stan:Smith:Detroit:MI Jim:Jones:Farmington Hills:MI Jack:Frost:Denver:CO Sue:Apple:New York:NY Cindy:Thompson:Battle Creek:MI John:Smith:Denver:CO George:Jones:New York:NY Need to create a shell script This script will display... (1 Reply)
Discussion started by: jakemathew
1 Replies

4. Shell Programming and Scripting

guidance required: feed load search & display in shell scripting

Hi All, I am fairly new to Shell Scripting, however learning fast ;-) I have been asked to do the below basic shell script :confused: There are few feed files we are recieving in the server from multiple locations spread out during the day, rite now we are checking manually each file... (2 Replies)
Discussion started by: sachaan
2 Replies

5. Shell Programming and Scripting

How to calculate months and display in shell scripting

I just want to know, how do we calculate the months in shell scripting. If i give the input as 20-01-2011, the output should be 20-02-2011, 20-03-2011 or 20-04-2011........ How do i get this ? Cheers. (6 Replies)
Discussion started by: sachin24
6 Replies

6. Shell Programming and Scripting

Assigning value of SQL output to a variable in shell scripting

I am trying to assgn the output of the select statement to a variable, like this "VARIABLE_NAME=$ db2 "select COLUMN_NAME_1 from TABLE_NAME where COLUMN_NAME_2='VALUE_TO_CHECK'"; " but the value that is getting into VARIABLE_NAME is "COLUMN_NAME_1 ----------------- VALUE 1... (3 Replies)
Discussion started by: sgmini
3 Replies

7. UNIX for Dummies Questions & Answers

Command display output on console and simultaneously save the command and its output

Hi folks, Please advise which command/command line shall I run; 1) to display the command and its output on console 2) simultaneous to save the command and its output on a file I tried tee command as follows; $ ps aux | grep mysql | tee /path/to/output.txt It displayed the... (7 Replies)
Discussion started by: satimis
7 Replies

8. Shell Programming and Scripting

Bourne Shell: Clean Display of stored procedure's output

Environment: Sun UNIX Language: Bourne Shell I have the following script and it works fine. Unfortunately, from user's perspective, it looks very messy because the user is able to see the output of the process caused by the print command. Is there a better way to overcome it? Here's the... (10 Replies)
Discussion started by: totziens
10 Replies

9. AIX

Man command doesn't display any output amonst other problems

hi all, Newbie to Unix and AIX. So my apologies if this is in the wrong place, etc. Working on box - uname# uname -a AIX appt 3 5 00C08AAF4C00 when i type man (some valid command) it just returns me to the # prompt. Its running on the KSH shell. man was working but i was trying... (6 Replies)
Discussion started by: djdavies
6 Replies

10. UNIX for Dummies Questions & Answers

Man command doesn't display any output amonst other problems :-)

hi all, Newbie to Unix and AIX. So my apologies if this is in the wrong place, etc. Working on box - uname# uname -a AIX appt 3 5 00C08AAF4C00 when i type man (some valid command) it just returns me to the # prompt. Its running on the KSH shell. man was working but i was trying... (14 Replies)
Discussion started by: djdavies
14 Replies
Login or Register to Ask a Question