The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
4 column tsv file, output 1 specific column casphar Shell Programming and Scripting 6 11-12-2008 04:04 PM
how to cut off last column from the output manmeet Shell Programming and Scripting 9 11-05-2008 07:32 AM
Loop column output handband2 UNIX Desktop for Dummies Questions & Answers 1 11-03-2008 10:46 PM
awk/sed column replace using column header - help jkl_jkl Shell Programming and Scripting 10 06-18-2008 03:31 AM
Convert Header into Column in Text file vsubbu1000 Shell Programming and Scripting 7 08-06-2007 04:09 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-04-2008
ali560045's Avatar
ali560045 ali560045 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 328
getting the column header in the output !

i have a script that access the database and then returns some row. but in the command prompt it it not showing the column header. how to get that ?

below the script:
------------------------------------------------------------------------

Code:
#!/bin/ksh

. $HOME/conf/systemProperties/EnvSetup.properties

connect1=`sqlplus -silent pipe/da!!a5p@ednmudp.world << END
set pagesize 1000 linesize 1000 feedback off verify off heading off echo off
select substr(module,1,39) "Module",
substr(state,1,15) "State",
to_char(start_time,'mm/dd/yy hh24:mi:ss') "Start",
to_char(end_time,'mm/dd/yy hh24:mi:ss') "End",
round((end_time-start_time)*1440,2) "Duration",
step "Step"
from dbsync_runtime_stats
order by step;
exit;
END`

echo "$connect1"
------------------------------------------------------------

result i got

Code:
MeterExchange                           Derive          12/03/08 22:02:05 12/03/08 22:02:10        .08         80
Incr_Sync                               TrimTXUTable    12/03/08 22:02:10 12/03/08 22:02:10          0        100
Incr_Sync                               TrimTable       12/03/08 22:02:10 12/03/08 22:02:53        .72        110
CTPT                                    Derive          12/03/08 22:02:53 12/03/08 22:03:22        .48       1300
----------------------------------------------------------------------

my desired o/p should with the column header:

Code:
Module                                  State           Start             End                 Duration       Step
--------------------------------------- --------------- ----------------- ----------------- ---------- ----------

MeterExchange                           Derive          12/03/08 22:02:05 12/03/08 22:02:10        .08         80
Incr_Sync                               TrimTXUTable    12/03/08 22:02:10 12/03/08 22:02:10          0        100
Incr_Sync                               TrimTable       12/03/08 22:02:10 12/03/08 22:02:53        .72        110
CTPT                                    Derive          12/03/08 22:02:53 12/03/08 22:03:22        .48       1300

Last edited by DukeNuke2; 12-04-2008 at 03:31 AM.. Reason: added code tags for better reading
  #2 (permalink)  
Old 12-04-2008
Wolfclaw Wolfclaw is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 5
Try the set option
Code:
 heading on
instead of
Code:
 heading off
, on line 6

Link
  #3 (permalink)  
Old 12-04-2008
manosubsulo manosubsulo is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 87
ali560045,

Code:
set pagesize 1000 linesize 1000 feedback off verify off heading off echo off
Replace the above line as
set pagesize 1000 linesize 1000 feedback off verify off heading on echo off
  #4 (permalink)  
Old 12-04-2008
vidyadhar85's Avatar
vidyadhar85 vidyadhar85 is offline Forum Staff  
Moderator(The Tutor)
  
 

Join Date: Jun 2008
Location: INDIA
Posts: 1,390
Quote:
Originally Posted by ali560045 View Post
i have a script that access the database and then returns some row. but in the command prompt it it not showing the column header. how to get that ?

below the script:
------------------------------------------------------------------------

#!/bin/ksh

. $HOME/conf/systemProperties/EnvSetup.properties

connect1=`sqlplus -silent pipe/da!!a5p@ednmudp.world << END
set pagesize 1000 linesize 1000 feedback off verify off heading off echo off
select substr(module,1,39) "Module",
substr(state,1,15) "State",
to_char(start_time,'mm/dd/yy hh24:mi:ss') "Start",
to_char(end_time,'mm/dd/yy hh24:mi:ss') "End",
round((end_time-start_time)*1440,2) "Duration",
step "Step"
from dbsync_runtime_stats
order by step;
exit;
END`

echo "$connect1"
------------------------------------------------------------

result i got

MeterExchange Derive 12/03/08 22:02:05 12/03/08 22:02:10 .08 80
Incr_Sync TrimTXUTable 12/03/08 22:02:10 12/03/08 22:02:10 0 100
Incr_Sync TrimTable 12/03/08 22:02:10 12/03/08 22:02:53 .72 110
CTPT Derive 12/03/08 22:02:53 12/03/08 22:03:22 .48 1300

----------------------------------------------------------------------

my desired o/p should with the column header:

Module State Start End Duration Step
--------------------------------------- --------------- ----------------- ----------------- ---------- ----------

MeterExchange Derive 12/03/08 22:02:05 12/03/08 22:02:10 .08 80
Incr_Sync TrimTXUTable 12/03/08 22:02:10 12/03/08 22:02:10 0 100
Incr_Sync TrimTable 12/03/08 22:02:10 12/03/08 22:02:53 .72 110
CTPT Derive 12/03/08 22:02:53 12/03/08 22:03:22 .48 1300
remove that heading off thats it
  #5 (permalink)  
Old 12-04-2008
ali560045's Avatar
ali560045 ali560045 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 328
thanks a lot for the help. got it
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:28 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0