Output coming in different line instead of single line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Output coming in different line instead of single line
# 1  
Old 08-18-2009
Output coming in different line instead of single line

Hi Guys,

I have an oracle database, I am trying to query the database and route it to file.

But the records instead of coming in a single line, are coming in three lines.

Can you please help me.. in this..

Code:
sqlplus -s $SRMUserid/$SRMPassword@$SRMServer<< EOF >log.out;
select * from cisdba.s_rot where rownum=1;
exit
EOF
>cat log.out

    OBJ_ID   CLASS_ID   OBJ_TYPE S S_ROT_TIME_ S_ROT_USR_ID S_ROT_IS_PRIVATE
---------- ---------- ---------- - ----------- ------------ ----------------
S_ROT_OBJ_TEMPL_PTR BOTTOM_CLASS_ID S_ROT_CREATE_USR_ID S_ROT_ATT_COUNT
------------------- --------------- ------------------- ---------------
S_ROT_NOTE_COUNT S_ROT_CREAT S_ROT_TEMPLATE_KEY   S_SITEM_OWNER_GROUPSS
---------------- ----------- -------------------- ---------------------
    168634        120          1 C 19-MAR-2001        52001                0
                                120               52001               0
               0 19-MAR-2001

It should be
Code:
   OBJ_ID   CLASS_ID   OBJ_TYPE S S_ROT_TIME_ S_ROT_USR_ID S_ROT_IS_PRIVATE S_ROT_OBJ_TEMPL_PTR BOTTOM_CLASS_ID S_ROT_CREATE_USR_ID S_ROT_ATT_COUNT S_ROT_NOTE_COUNT S_ROT_CREAT S_ROT_TEMPLATE_KEY   S_SITEM_OWNER_GROUPSS
---------- ---------- ---------- - ----------- ------------ ----------------------------------- --------------- ------------------- ------------------------------- ----------- -------------------- ---------------------
    168634        120          1 C 19-MAR-2001        52001                0            120               52001               0               0 19-MAR-2001

Thanks for your help..
# 2  
Old 08-18-2009
Try using the -w option, like -w140 to extend the line length. Works in isql...
Padow
# 3  
Old 08-18-2009
padow, do u mean as

Code:
sqlplus -s -w140 $SRMUserid/$SRMPassword@$SRMServer<< EOF >log.out;

# 4  
Old 08-18-2009
like this ...

Code:
 
SQL> select * from emp where rownum=1;
     EMPNO ENAME      JOB              MGR HIREDATE           SAL       COMM
---------- ---------- --------- ---------- ----------- ---------- ----------
    DEPTNO
----------
      7521 WARD       SALESMAN        7698 22-FEB-1981       1000        500
        30
 
SQL> set lines 200
SQL> /
     EMPNO ENAME      JOB              MGR HIREDATE           SAL       COMM     DEPTNO
---------- ---------- --------- ---------- ----------- ---------- ---------- ----------
      7521 WARD       SALESMAN        7698 22-FEB-1981       1000        500         30

scripter
# 5  
Old 08-18-2009
Quote:
Originally Posted by scripter.online
like this ...

Code:
 
SQL> select * from emp where rownum=1;
     EMPNO ENAME      JOB              MGR HIREDATE           SAL       COMM
---------- ---------- --------- ---------- ----------- ---------- ----------
    DEPTNO
----------
      7521 WARD       SALESMAN        7698 22-FEB-1981       1000        500
        30
 
SQL> set lines 200
SQL> /
     EMPNO ENAME      JOB              MGR HIREDATE           SAL       COMM     DEPTNO
---------- ---------- --------- ---------- ----------- ---------- ---------- ----------
      7521 WARD       SALESMAN        7698 22-FEB-1981       1000        500         30

scripter
Scripter World: UNIX if condition or test command in UNIX
This only shows the first record.

Try adding "set LINESIZE ...." or "set wrap off" to your SQL.

Code:
SQL> set wrap on
SQL>  select * from dba_tablespaces

TABLESPACE_NAME                BLOCK_SIZE INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS
------------------------------ ---------- -------------- ----------- -----------
MAX_EXTENTS PCT_INCREASE MIN_EXTLEN STATUS    CONTENTS  LOGGING   FOR EXTENT_MAN
----------- ------------ ---------- --------- --------- --------- --- ----------
ALLOCATIO PLU SEGMEN DEF_TAB_ RETENTION   BIG
--------- --- ------ -------- ----------- ---
SYSTEM                               8192          65536                       1
 2147483645                   65536 ONLINE    PERMANENT LOGGING   NO  LOCAL
SYSTEM    NO  MANUAL DISABLED NOT APPLY   NO

UNDOTBS1                             8192          65536                       1
 2147483645                   65536 ONLINE    UNDO      LOGGING   NO  LOCAL
SYSTEM    NO  MANUAL DISABLED NOGUARANTEE NO

TABLESPACE_NAME                BLOCK_SIZE INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS
------------------------------ ---------- -------------- ----------- -----------
MAX_EXTENTS PCT_INCREASE MIN_EXTLEN STATUS    CONTENTS  LOGGING   FOR EXTENT_MAN
----------- ------------ ---------- --------- --------- --------- --- ----------
ALLOCATIO PLU SEGMEN DEF_TAB_ RETENTION   BIG
--------- --- ------ -------- ----------- ---

SYSAUX                               8192          65536                       1
 2147483645                   65536 ONLINE    PERMANENT LOGGING   NO  LOCAL
SYSTEM    NO  AUTO   DISABLED NOT APPLY   NO

TEMP                                 8192        1048576     1048576           1
                       0    1048576 ONLINE    TEMPORARY NOLOGGING NO  LOCAL

TABLESPACE_NAME                BLOCK_SIZE INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS
------------------------------ ---------- -------------- ----------- -----------
MAX_EXTENTS PCT_INCREASE MIN_EXTLEN STATUS    CONTENTS  LOGGING   FOR EXTENT_MAN
----------- ------------ ---------- --------- --------- --------- --- ----------
ALLOCATIO PLU SEGMEN DEF_TAB_ RETENTION   BIG
--------- --- ------ -------- ----------- ---
UNIFORM   NO  MANUAL DISABLED NOT APPLY   NO

USERS                                8192          65536                       1
 2147483645                   65536 ONLINE    PERMANENT LOGGING   NO  LOCAL
SYSTEM    NO  AUTO   DISABLED NOT APPLY   NO

EXAMPLE                              8192          65536                       1

TABLESPACE_NAME                BLOCK_SIZE INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS
------------------------------ ---------- -------------- ----------- -----------
MAX_EXTENTS PCT_INCREASE MIN_EXTLEN STATUS    CONTENTS  LOGGING   FOR EXTENT_MAN
----------- ------------ ---------- --------- --------- --------- --- ----------
ALLOCATIO PLU SEGMEN DEF_TAB_ RETENTION   BIG
--------- --- ------ -------- ----------- ---
 2147483645                   65536 ONLINE    PERMANENT NOLOGGING NO  LOCAL
SYSTEM    YES AUTO   DISABLED NOT APPLY   NO


6 rows selected.

Code:
SQL> set wrap off
SQL> r
  1* select * from dba_tablespaces

TABLESPACE_NAME                BLOCK_SIZE INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS
------------------------------ ---------- -------------- ----------- -----------
SYSTEM                               8192          65536                       1
UNDOTBS1                             8192          65536                       1
SYSAUX                               8192          65536                       1
TEMP                                 8192        1048576     1048576           1
USERS                                8192          65536                       1
EXAMPLE                              8192          65536                       1

6 rows selected.


Last edited by Scott; 08-18-2009 at 03:23 PM..
# 6  
Old 08-20-2009
Thanks Guys, i used SET LINESIZE command..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Get an output of lines in pattern 1st line then 10th line then 11th line then 20th line and so on.

Input file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 (6 Replies)
Discussion started by: Sagar Singh
6 Replies

2. UNIX for Beginners Questions & Answers

Output to file print as single line, not separate line

example of problem: when I echo "$e" >> /home/cogiz/file.txt result prints to file as:AA BB CC I need it to save to file as this:AA BB CC I know it's probably something really simple but any help would be greatly appreciated. Thank You. Cogiz (7 Replies)
Discussion started by: cogiz
7 Replies

3. Shell Programming and Scripting

convert single line output to multiple line

Hi all, I have a single line output like below echo $ips 10.26.208.28 10.26.208.26 10.26.208.27 want to convert above single line output as below format. Pls advice how to do ? 10.26.208.28 10.26.208.26 10.26.208.27 Regards Kannan (6 Replies)
Discussion started by: kamauv234
6 Replies

4. Shell Programming and Scripting

Output to single line

Hi, I am using below command and getting below output. echo "dis ql(*) CLUSTER"|runmqsc CT.QM.ASSA10T1| egrep 'QUEUE|CLUSTER'|egrep -v 'SYSTEM|XMITQ'| sed -e 's/QUEUE(/ /g' -e 's/TYPE(QLOCAL)/ /g' -e 's/CLUSTER(/ /g' -e 's/)/ /g' output CT.CL.ALLUHUB.FLST_TO_HUB_PROV.01... (20 Replies)
Discussion started by: darling
20 Replies

5. Shell Programming and Scripting

Joining multi-line output to a single line in a group

Hi, My Oracle query is returing below o/p ---------------------------------------------------------- Ins trnas value a lkp1 x a lkp1 y b lkp1 a b lkp2 x b lkp2 y ... (7 Replies)
Discussion started by: gvk25
7 Replies

6. Shell Programming and Scripting

Merge multi-line output into a single line

Hello I did do a search and the past threads doesn't really solve my issue. (using various awk commands) I need to combine the output from java -version into 1 line, but I am having difficulties. When you exec java -version, you get: java version "1.5.0_06" Java(TM) 2 Runtime... (5 Replies)
Discussion started by: flagman5
5 Replies

7. Shell Programming and Scripting

Output to be in single line

Hi All, Small script but :wall:, please help in this regard. for i in 1 2 3 do echo $i done result : 1 2 3 I want the above to be printed as below expected result: 1 2 3 Thanks in advance :) (3 Replies)
Discussion started by: girish_satyam
3 Replies

8. Shell Programming and Scripting

single line input to multiple line output with sed

hey gents, I'm working on something that will use snmpwalk to query the devices on my network and retreive the device name, device IP, device model and device serial. I'm using Nmap for the enumeration and sed to clean up the results for use by snmpwalk. Once i get all the data organized I'm... (8 Replies)
Discussion started by: mitch
8 Replies

9. AIX

ls command output in single line

Hi, Can anyone suggest me how can I display the output of ls command in single line with some delimiter say pipe (|)? I know it can be done by writing a script by using the loops but I wanted to know are there any other single line commands? Thanks for your help Sheshadri (7 Replies)
Discussion started by: arsheshadri
7 Replies

10. Shell Programming and Scripting

Multi-line output to single line

Hello, How can I take the following output: outputa outputb outputc and turn it into single line ouput, with a single space between each field like below: outputa outputb outputc (7 Replies)
Discussion started by: LinuxRacr
7 Replies
Login or Register to Ask a Question