Re: Trying to write a short script

From: Philip Douglass <philipsd_at_gmail.com>
Date: Thu, 22 Sep 2011 17:31:39 -0400
Message-ID: <CADsViB=FnYvpVq4EXFwYnocgPNemkNczDuSX35Eh-0SwmST4pg_at_mail.gmail.com>



Well you could adjust IFS:
OLDIFS=$IFS
IFS=''
DUMP=`sqlplus -s / as sysdba <<EOF
set head off
set feedback off
select * from v\\$version;
exit
EOF`
echo $DUMP
IFS=$OLDIFS But I prefer to write that pattern this way:

sqlplus -s / as sysdba <<EOF
set head off
set feedback off
select * from v\$version;
exit
EOF | while read line

        echo $line
done

Since it's usually more useful to process it line by line.

On Thu, Sep 22, 2011 at 4:43 PM, Laurent, Vincent <Vince_Laurent_at_ssmhc.com>wrote:

> I am currently using Oracle 11.2.0.2 on HP-UX 11.31
> I have a script that does this:
>
> # Get the path to the trace files
> DUMP=`/oracle/$ORACLE_SID/112_64/bin/sqlplus -s / as sysdba <<EOF
> set head off
> set feedback off
> select * from v\\$version;
> exit
> EOF`
> echo $DUMP
>
> but the output comes back like this (all wrapped as one line):
>
> Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit
> Production PL/SQL Release 11.2.0.2.0 - Production CORE 11.2.0.2.0 Production
> TNS for HPUX: Version 11.2.0.2.0 - Production NLSRTL Version 11.2.0.2.0 -
> Production
>
> Instead of like this (each product it's own line):
>
> Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit
> Production
> PL/SQL Release 11.2.0.2.0 - Production
> CORE 11.2.0.2.0 Production
> TNS for HPUX: Version 11.2.0.2.0 - Production
> NLSRTL Version 11.2.0.2.0 - Production
>
> Ideas to fix?
>
>
>
> Confidentiality Notice: This email message, including any
> attachments, is for the sole use of the intended recipient(s) and
> may contain confidential and privileged information. Any
> unauthorized review, use, disclosure or distribution is prohibited.
> If you are not the intended recipient, please contact the sender by
> reply email and destroy all copies of the original message.
> --
> http://www.freelists.org/webpage/oracle-l
>
>
>

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Sep 22 2011 - 16:31:39 CDT

Original text of this message