Output selection with EOF


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Output selection with EOF
# 1  
Old 08-06-2012
Output selection with EOF

I have a script:
Code:
#!/bin/ksh
runmqsc CERN.PROD <<EOF
dis chs(to.*)
end
EOF

which gives me the output as:
Code:
     1 : dis chs(to.*)
AMQ8417: Display Channel Status details.
   CHANNEL(TO.CGPRODAPP2)                  CHLTYPE(CLUSRCVR)
   CONNAME(10.60.16.50)                    CURRENT
   RQMNAME(CERN.PROD)           STATUS(RUNNING)
   SUBSTATE(RECEIVE)                    
AMQ8417: Display Channel Status details.
   CHANNEL(TO.CGPRODAPP1)                  CHLTYPE(CLUSSDR)
   CONNAME(10.60.16.50(50001))             CURRENT
   RQMNAME(CERN.PROD)           STATUS(RUNNING)
   SUBSTATE(MQGET)                         XMITQ(SYSTEM.CLUSTER.TRANSMIT.QUEUE)
     2 : end

What I need is to have it send me e-mail when either of
Code:
STATUS(RUNNING)

is not showing as
Code:
(RUNNING)

.

Please note that there are 2 of STATUS(RUNNING) lines.

Please advise.


Moderator's Comments:
Mod Comment Please use code tags next time for your code and data instead of PHP tags, thanks.

Last edited by zaxxon; 08-06-2012 at 10:28 AM.. Reason: code tags
# 2  
Old 08-06-2012
Where are you stuck exactly? What did you try and maybe show the script using code tags.
# 3  
Old 08-06-2012
I need to grep the output when the two lines are not
Code:
STATUS(RUNNING)

.
# 4  
Old 08-06-2012
Ok, and where is the problem to use grep? It will also return a code in the shell variable $?.
A value that is not equal zero will indicate that grep was not successful finding the pattern.
# 5  
Old 08-07-2012
I am pretty much stuck after this code.
Code:
#!/bin/ksh
runmqsc CERN.PROD <<EOF
dis chs(to.*)
end
EOF

I was thinking..
Code:
#!/bin/ksh
runmqsc CERN.PROD <<EOF
dis chs(to.*)
end
EOF > mqmon.out

but, obviously, it is not the way...
# 6  
Old 08-07-2012
Put it on the top.

Code:
#!/bin/ksh
runmqsc CERN.PROD >output <<EOF
dis chs(to.*)
end
EOF

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How To Redirect The Output When We Are Usinf EOF In The Same Line?

need to login 4 systems to check whether the systems are accessible or not using rlogin command,after each login i will exit.After issuing the command rlogin abc if it is not responding i will get a message of "connection timed out" . So i want to automate this task .so i tried like below: EX: ... (3 Replies)
Discussion started by: kankuro9x
3 Replies

2. Shell Programming and Scripting

How to redirect the output when we are usinf EOF in the same line?

need to login 4 systems to check whether the systems are accessible or not using rlogin command,after each login i will exit.After issuing the command rlogin abc if it is not responding i will get a message of "connection timed out" . So i want to automate this task .so i tried like below : EX:... (1 Reply)
Discussion started by: charanarjun
1 Replies

3. Shell Programming and Scripting

If Selection statement

ok im kinda stuck i have a bash script with 4 options 1. Create Script 2. Show Script 3 . Delete script 4. Exithow would i use an if statement for this? im not sure what test command i would use. I know it would be like this (below) to display the script if then cat script1or for the... (10 Replies)
Discussion started by: gangsta
10 Replies

4. Shell Programming and Scripting

Date selection

Hi All, i have log file sample data is 2010/10/09|04:00:00.392|15Minute|BW=0|192.168.0.1 2010/10/08|04:00:00.392|15Minute|BW=0|192.168.0.1 2010/10/07|04:00:00.392|15Minute|BW=0|192.168.0.1 2010/10/05|04:00:00.392|15Minute|BW=0|192.168.0.1 2010/10/03|04:00:00.392|15Minute|BW=0|192.168.0.1... (2 Replies)
Discussion started by: posner
2 Replies

5. Shell Programming and Scripting

Data selection

Hi, Please note that as a programmer I cannot tell the file format or details of my production files so I have re-framed my file and taken a case of departments. Kindly guide as its related to a production requirement of data containing recors of production customer NOT A HOMEWORK :) I have... (10 Replies)
Discussion started by: test_user
10 Replies

6. Shell Programming and Scripting

confused with << EOF EOF

Hi friends , I am confused with << EOF EOF Most of the cases I found sqlplus $db_conn_str << EOF some sql staments EOF another exapmle is #!/bin/sh echo -n 'what is the value? ' read value sed 's/XXX/'$value'/' <<EOF The value is XXX EOF (1 Reply)
Discussion started by: imipsita.rath
1 Replies

7. Post Here to Contact Site Administrators and Moderators

Opt out selection

Maybe I'm missing something but when I go to CP->Options, I see the box for selecting which forum to opt out of but no way to set it. (5 Replies)
Discussion started by: drhowarddrfine
5 Replies

8. UNIX for Advanced & Expert Users

tray selection

Hello All, Could anyone help me how to selecting the trays in unix . Thanks, Amit kul (3 Replies)
Discussion started by: amit kul
3 Replies

9. Shell Programming and Scripting

Array and Selection

I have a question: Y X Tabel a is a array multidimensional --> a(1024,20) I load in to array a Text from 6000 row where: in a(1,1) is present the row 1 of original text, in a(1024,1) is present then row 1024 of original test and in... (4 Replies)
Discussion started by: ZINGARO
4 Replies
Login or Register to Ask a Question