Hi
An SQL that returns line brakes gives me problems.
I have this script (set by the id condition to only return 1 row). But it appears as 2 lines in the output.
This is the result.
The thing is that it reads 2 lines. I do need to process every line as an individual element.
Any ideers on how to solve it?
Thanks
Lhg
An SQL that returns line brakes gives me problems.
I have this script (set by the id condition to only return 1 row). But it appears as 2 lines in the output.
Code:
#!/bin/ksh
#############################################
# Oracle setup - sets up ORACLE PATCH and echoon cridentials
. $HOME/CFG/.db_profile_JBOSS
sql="SELECT '<ROWID>'||a.rowid||'<ROWID><AID>'||a.id||'<AID>
<ACTIME>'||a.ctime||'<ACTIME><RID>'||r.id||'<RID><NAME>'||r.NAME||'<NAME>
<PRIORITY>'||ad.priority||'<PRIORITY>
<DESCRIPTION>'||ad.description||'<DESCRIPTION><VALUE>'||cl.VALUE||'<VALUE>'
FROM rhq.rhq_alert a, rhq.rhq_alert_definition ad, rhq.rhq_alert_condition_log cl, rhq.rhq_resource r, rhq.rhq_resource_type rt
WHERE a.alert_definition_id = ad.id AND cl.alert_id = a.id AND r.id =
ad.resource_id AND r.resource_type_id = rt.id AND rt.NAME = 'JBossAS
Server'
AND r.NAME LIKE 'balor%'
AND ad.NAME NOT IN ('Datasources - Available connections', 'RHQ Agent - Clock difference')
and a.id = '1063524'
ORDER BY a.ctime DESC;"
echo "set linesize 32767
set pagesize 999
set head off
set feed off
$sql"|nawk 'NF' | sqlplus -s ${JBOSSuser}/${JBOSSpass}@${JBOSSinst} | nawk 'NF' |while read line; do
echo "---------------Whole line-----------------"
echo "$line"
done
This is the result.
---------------Whole line-----------------
<ROWID>AAATAbAAGAAACqfAAU<ROWID><AID>1063524<AID>
<ACTIME>1235662809990<ACTIME><RID>504429<RID><NAME>xxxxxxxxxxxx JBossSOA
4.3.0.GA_SOA balor02 (172.17.61.103:1099)<NAME><PRIORITY>HIGH<PRIORITY>
<DESCRIPTION>An alert is raised if any log entries of severity ERROR are
encountered.<DESCRIPTION><VALUE>ERROR, extraInfo=
[[dservices.ResourceOrder] (http-172.33.61.3333-8080-12 A message could
not be delivered to the ResourceOrderWSGateway service
---------------Whole line-----------------
org.jboss.soa.esb.listeners.message.MessageDeliverException: Failed<VALUE>
The thing is that it reads 2 lines. I do need to process every line as an individual element.
Any ideers on how to solve it?
Thanks
Lhg