HI,
I am using below command to display the words, but i am getting awk error. Please help me out on this
I am using below code
echo "dis clusqmgr(*) cluster(BT.CL.APOLLOC1) conname qmtype deftype"| runmqsc BT.QM.ASSA10T1| egrep 'CHANNEL|QMTYPE|CLUSQMGR|CONNAME'|sed -e 's/CLUSQMGR(/+/g'|sed 's/)/,/g'|sed 's/(/,/g'|tr -d "\n"|tr "+" "\n"|tr -d " "|awk -F,'{ print $1 $2 $3 }'
i am getting error as
If i use below code i am getting below OP
Output from where i am trying to select the fields after delimiter ","
echo "dis clusqmgr(*) cluster(BT.CL.APOLLOC1) conname qmtype deftype"| runmqsc BT.QM.ASSA10T1| egrep 'CHANNEL|QMTYPE|CLUSQMGR|CONNAME'|sed -e 's/CLUSQMGR(/+/g'|sed 's/)/,/g'|sed 's/(/,/g'|tr -d "\n"|tr "+" "\n"|tr -d " "
BT.QM.ASNA02T1,CHANNEL,TO_QM_ASNA02T1.C1,CLUSTER,BT.CL.APOLLOC1,CONNAME,10.81.30.19,51431,,DEFTYPE,CLUSSDRB,QMTYPE,NORMAL,
from here i want to select 1,2, and 3rd fields after ","
| awk -F, '{print $1,$2,$3}'
Unless there is no syntax error in the awk statement this error is due to incompatible awk your trying to invoke. Try with nawk instead of awk nawk -F,'{ print $1 ...
Also post the OS your using
@balajesuri : Its working thanks...
@michael : i tried it but no luck i am using OS sol5.9
aigles
March 14, 2012, 10:54am
5
Try /usr/xpg4/bin/awk
instead of nawk
Jean-Pierre.
you can use dis simply
awk -F"," '{print $1,$2,$3}'