Shell script to csv


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell script to csv
# 8  
Old 03-15-2012
I mean the outputs from "dis qr($queue) rname", and the like.

Without seeing what data's being fed into your code I have little hope of guessing what's going to come out of it, or why.
# 9  
Old 05-23-2012
output of "dis qr($queue) rname" is

Code:
    QUEUE(CCF.IPORB5T5.ORB.LLUHUB_TO_ORBBAM_APO.01)
    TYPE(QREMOTE)
    RNAME(CCF.PR.IPORB5T5.ORB.LLUHUB_TO_ORBBAM_APO.01)

---------- Post updated at 09:22 AM ---------- Previous update was at 09:04 AM ----------

I have a shellscript which gives output as below

Code:
#!/bin/ksh

QMGR=$1
RQM=$2
echo "enter Qm"
read QMGR
echo "enter RQM"
read RQM


echo "Displaying Remote queue information\n"
echo "\nQUEUE,RNAME,XMITQ,CHANNEL,IPADDRESS"
echo "dis q(*) where(RQMNAME eq $RQM)"|runmqsc -e $QMGR|grep QUEUE|sed -e 's/QUEUE(/ /g' -e 's/)/ /g' -e 's/TYPE(QREMOTE/ /g'| while read queue
do
rq=$queue
lq=`echo "dis qr($queue) rname"|runmqsc $QMGR| tr ' ' '\n' | sed 's/^*//g'|grep RNAME| cut -d '(' -f2| cut -d ')' -f1`
xmitq=`echo "dis qr($queue) xmitq"|runmqsc $QMGR| tr ' ' '\n' | sed 's/^*//g'|grep XMITQ| cut -d '(' -f2| cut -d ')' -f1`
chl=`echo "dis chl(*) xmitq"| runmqsc $QMGR |egrep 'CHANNEL|XMITQ'|egrep -v 'CLUSSDR|CLUSRCVR|RCVR|SYSTEM|SVRCONN'|sed 's/'CHANNEL'/+/g'|tr -d '\n'|tr '+' '\n'|grep $xmitq|awk '{print $1}'| sed -e 's/(/ /' -e 's/)/ /'`
ip=`echo "dis chl($chl) conname"|runmqsc $QMGR | tr ' ' '\n' | sed 's/*^//'| grep CONNAME| cut -d '(' -f2`
aq=`echo "dis qa(*) where(TARGQ eq '$queue')"|runmqsc -e $QMGR|grep QUEUE|sed -e 's/QUEUE(/ /g' -e 's/)/ /g' -e 's/TYPE(QALIAS/ /g'`
echo $aq,$rq,$lq,$xmitq,$chl, $ip
done

echo "Displaying cluster out bound Queue on $RQM\n"
echo "dis qc(*) where(clusqmgr eq $RQM)"|runmqsc -e $QMGR|grep QUEUE|sed -e 's/QUEUE(/ /g' -e 's/)/ /g'
echo "\n"
echo "Displaying cluster channel information to $RQM\n"
echo "\nCLUSTER,CHANNEL,IPADDRESS,PORT,QMTYPE"
echo "dis clusqmgr('$RQM') cluster(*) conname qmtype deftype status"|runmqsc -e $QMGR|egrep 'CHANNEL|QMTYPE|CLUSQMGR|CONNAME'|sed -e 's/CLUSQMGR(/+/g'|sed 's/)/,/g'|sed 's/(/,/g'|tr -d "\n"|tr "+" "\n"|tr -d " "| nawk -F"," -v OFS=',' '{print $3, $5, $7, $8, $13}'

and output is below... i want to get output into $QMGR_inf.csv

Code:
mqm@hwEHCss5 $ ./inf.sh
enter Qm
SSV.QM.HWCH05T6
enter RQM
SSV.QM.ASSA10T1
Displaying Remote queue information


QUEUE,RNAME,XMITQ,CHANNEL,IPADDRESS
,SSV.ASSA10T1.HUB.EHCSS_TO_HUB_APO.01,SSV.PR.ASSA10T1.HUB.EHCSS_TO_HUB_APO.01,SSV.XM.HWCH05T6_ASSA10T1.B1, HWCH05T6.ASSA10T1.B1 , 10.81.30.140
Displaying cluster out bound Queue on SSV.QM.ASSA10T1

    SSV.CL.EHCLLUT2.LLU.EHCSS_TO_HUBLLU_APO.01


Displaying cluster channel information to SSV.QM.ASSA10T1


CLUSTER,CHANNEL,IPADDRESS,PORT,QMTYPE
,,,,
EHCLLUT2.ASSA10T1.C1,SSV.CL.EHCLLUT2,10.81.30.140,51431,NORMAL
TO_QM_ASSA10T1.C1,SSV.CL.APOLLOC1,10.81.30.140,51431,REPOS

Can you please let me know how to get this output into csv file. Incode where i need to mention to convert into csv
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shell script to fetch values in csv

I need to fetch below values from this file. (1 Reply)
Discussion started by: nit42
1 Replies

2. Programming

Shell script - to see if any change from last csv

hi all, i attach a csv file of what im trying to explain basically i get iMacro (like an excel macro that you can record and play back recordings but its for web browsers) to download csv reports of the printer(s) when you open the csv report it contains certain cells - D7 - black... (5 Replies)
Discussion started by: robertkwild
5 Replies

3. Shell Programming and Scripting

CSV File Creation Within Shell Script

Hi All, I am trying to create a CSV file within a shell script test.ksh and the code snippet is something like below: #!/usr/bin/ksh # Set required variables. . $HOME/.prof # Output file path Group1=/tmp/G1.csv Group2=/tmp/G2.csv Group3=/tmp/G3.csv $ORACLE_HOME/bin/sqlplus -s... (2 Replies)
Discussion started by: swasid
2 Replies

4. Shell Programming and Scripting

Reading a csv file using shell script

Hello All, I have a csv file that looks like below ProdId_A,3.3.3,some text,some/text,sometext_1.2.3 ProdId_B,3.3.3,some text,some/text,sometext_1.2.3 ProdId_C,3.3.3,some text,some/text,sometext_1.2.3 ProdId_A,6.6.6,some text,some/text,sometext_9.9.9 I will get ProdId from... (5 Replies)
Discussion started by: anand.shah
5 Replies

5. UNIX for Dummies Questions & Answers

Help to parse csv file with shell script

Hello ! I am very aware that this is not the first time this question is asked here, because I have already read a lot of previous answers, but none of them worked, so... As said in the title, I want to read a csv file with a bash script. Here is a sample of the file: ... (4 Replies)
Discussion started by: Grhyll
4 Replies

6. Shell Programming and Scripting

Shell script for CSV conversion

thanks for allowing me join your forum i have an output of linux command "who" which provides following details..... CURRENT USER/ACCT INFO 17:31:36 up 4:49, 4 users, load average: 0.03, 0.04, 0.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root :0 - 12:59 ?xdm? 4:54 0.02s /bin/sh /usr/bi... (1 Reply)
Discussion started by: ayyappancheta
1 Replies

7. Shell Programming and Scripting

convert this into csv using awk/shell script

Hi Scripting gurus, I need to convert following text snippet into csv. please help Input heading1 = data1 heading2 = data2 .. .. heading n = data n heading 1 = data1 .. .. Output data1,data2,....,data n (3 Replies)
Discussion started by: azs0309
3 Replies

8. UNIX for Advanced & Expert Users

format csv file using shell script

i have a report.csv file from oracle datavase In that file data is like this with report heading and date SALES DAILY REPORT DATE: 06-26-2007 REPORT NAME: SALES DATA AA.BB.CCCC.DDDD,BBBBB,06-26-2007,0,BEGIN,END ZZ.VV.DDDD.XXXXXXX,MMMMMM,06-25-2007,18,BEGIN,END... (3 Replies)
Discussion started by: raosurya
3 Replies

9. Shell Programming and Scripting

Help in parsing a CSV file with Shell script

I have a CSV file which contains number series as one of the fields. Some of the records of the field look like : 079661/3 I have to convert the above series as 079661 079662 079663 and store it as 3 different records. Looking for help on how to achieve this. Am a newbie at Shell... (10 Replies)
Discussion started by: mihirk
10 Replies
Login or Register to Ask a Question