How to get full sql table data using shell script

i have a Oracle table like

col1 col2
---- -----
a       1
b       2
c       3

when i write a script for it , it gives me all the data in one column.
Please give me the solution which gives the exact result like we see in sql editors.

for a in `echo "
set feedback off;
set pagesize 40;
select * from tblname;
exit;" | sqlplus -s scott/tiger`
do
echo $a
done

Thanks,
Shrawan

Can you redirect o/p of sqlplus to a file and check what is delimeter?

`echo "
set feedback off;
set pagesize 40;
select * from tblname;
exit;" | sqlplus -s scott/tiger`  >tempfile

To find out delimeter, run below:

 cat tempfile | od -bc 

Once you find out, whether it is separated by newline(\n) or tab(\t), logic can be modified accordingly using tr/awk/sed etc.

Also check "-e" option in manual of "echo" command.