Home » Infrastructure » Unix » Customise the output display inside a shell script
Customise the output display inside a shell script [message #177177] Tue, 13 June 2006 06:23 Go to next message
janetwilson
Messages: 48
Registered: June 2006
Location: St.Louis
Member
Hi,

I had written a small shell script.

export MYCURRENTDIR=`pwd`
cd $ORACLE_HOME/bin
VALUE=`sqlplus -silent scott/tiger <<END
set feedback off;
set heading off;
select ename from emp ;
exit;
END`
echo $VALUE
cd $MYCURRENTDIR


But it will display the data in one line

SMITH ALLEN WARD JONES MARTIN BLAKE CLARK SCOTT KING TURNER ADAMS JAMES FORD MILLER


I want to display one record in one line.

Please guide me.

Regards
Janet Wilson
Re: Customise the output display inside a shell script [message #177317 is a reply to message #177177] Wed, 14 June 2006 02:58 Go to previous messageGo to next message
Frank Naude
Messages: 4565
Registered: April 1998
Senior Member
Try one of the following:

IFS="\n"
echo $VALUE


for ROW in $VALUE; do
  echo $ROW
done
Re: Customise the output display inside a shell script [message #177523 is a reply to message #177317] Thu, 15 June 2006 05:05 Go to previous message
janetwilson
Messages: 48
Registered: June 2006
Location: St.Louis
Member
Hi Frank,

It's working fine.
Both are working fine.
For loop is giving a good display than IFS.
Thanks.

Regards
Janet Wilson
Previous Topic: installation of oracle on unix
Next Topic: CPU usage in HP Tru 64
Goto Forum:
  


Current Time: Mon Nov 30 12:01:40 CST 2020