Sponsored Content
Full Discussion: Shell script to csv
Top Forums Shell Programming and Scripting Shell script to csv Post 302607813 by darling on Thursday 15th of March 2012 11:35:40 AM
Old 03-15-2012
PFB my full script

Quote:
#!/bin/ksh
QMGR=$1
echo "Displaying Remote queue information\n"
echo "\nQUEUE,RNAME,XMITQ,RQMNAME,CHANNEL,IPADDRESS"
echo "dis qr(*)" |runmqsc $QMGR| grep QUEUE| grep -v SYSTEM| cut -d '(' -f2| cut -d ')' -f1| 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`
rqm=`echo "dis qr($queue) rqmname"|runmqsc $QMGR| tr ' ' '\n' | sed 's/^*//g'|grep RQMNAME| 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/'CHA
NNEL'/+/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`
echo $rq $lq $xmitq $rqm $chl $ip| awk '{print $1 "," $2 "," $3 "," $4 "," $5 "," $6 }'
done
echo "\n"
echo "\nDisplaying Alias Queue Information\n"
echo "ALIAS QUEUE,TARGET QUEUE"
echo "dis qa(*)"| runmqsc $QMGR| grep QUEUE| grep -v SYSTEM| cut -d '(' -f2| cut -d ')' -f1| while read queue
do
qa=$queue
targq=`echo "dis qa($queue) targq"| runmqsc $QMGR| tr ' ' '\n' | sed 's/^*//g'|grep TARGQ| cut -d '(' -f2| cut -d ')' -f1`
echo $qa $targq| awk '{print $1"," $2}'
done
echo "\n"
echo "\nDisplaying Local queue information\n"
echo "\nLOCAL QUEUE"
echo "dis ql(*) USAGE"|runmqsc $QMGR| grep QUEUE|grep -v SYSTEM| grep -v XMITQ| cut -d '(' -f2 | cut -d ')' -f1
echo "\n\n"
echo "Displaying receiver channel information\n"
echo "CHANNEL,SENDER IPADDRESS"
echo "dis chl(*) chltype(rcvr)"| runmqsc $QMGR |grep CHANNEL|grep -v SYSTEM| cut -d '(' -f2 | cut -d ')' -f1| while read chl
do
ip=`echo "dis chs($chl)"|runmqsc $QMGR| tr ' ' '\n'| sed 's/^*//'| grep CONNAME| cut -d '(' -f2| cut -d ')' -f1`
echo $chl $ip| awk '{print $1","$2}'
done

I will give qmgr as input. I hope now u can understand
 

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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

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

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

8. 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

9. 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
echo(3XCURSES)						  X/Open Curses Library Functions					    echo(3XCURSES)

NAME
echo, noecho - enable/disable terminal echo SYNOPSIS
cc [ flag... ] file... -I /usr/xpg4/include -L /usr/xpg4/lib -R /usr/xpg4/lib -lcurses [ library... ] c89 [ flag... ] file... -lcurses [ library... ] #include <curses.h> int echo(void); int noecho(void); DESCRIPTION
The echo() function enables Echo mode for the current screen. The noecho() function disables Echo mode for the current screen. Initially, curses software echo mode is enabled and hardware echo mode of the tty driver is disabled. The echo() and noecho() functions control soft- ware echo only. Hardware echo must remain disabled for the duration of the application, else the behavior is undefined. RETURN VALUES
Upon successful completion, these functions return OK. Otherwise, they return ERR. ERRORS
No errors are defined. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
getch(3XCURSES), getstr(3XCURSES), initscr(3XCURSES), libcurses(3XCURSES), scanw(3XCURSES), attributes(5), standards(5) SunOS 5.10 5 Jun 2002 echo(3XCURSES)
All times are GMT -4. The time now is 09:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy