The UNIX and Linux Forums  


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
how to append spaces(say 10 spaces) at the end of each line based on the length of th prathima UNIX for Dummies Questions & Answers 17 01-28-2009 04:10 PM
AWK with allow me to add spaces rbulus Shell Programming and Scripting 3 03-08-2008 12:24 AM
LS with spaces darkyoda2 UNIX for Dummies Questions & Answers 2 05-25-2005 02:10 AM
Strip leading and trailing spaces only in a shell variable with embedded spaces jerardfjay Shell Programming and Scripting 6 03-07-2005 02:24 PM
How to pad spaces sarahho Shell Programming and Scripting 3 09-30-2002 06:45 AM

View Poll Results: Was the question clear?
Yes 0 0%
No 0 0%
Voters: 0. You may not vote on this poll

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 08-10-2006
Nomaad Nomaad is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 18
Why am I getting spaces when there is none??!!

param_data=`sqlplus -S $USER/$PASSWRD@$SCHEMA << EOF

SET ECHO OFF NEWP 0 SPA 0 PAGES 0 FEED OFF HEAD OFF TRIMS ON

VARIABLE param_data VARCHAR2(1000);

WHENEVER SQLERROR EXIT SQL.SQLCODE ROLLBACK;

SELECT INTERFACE_ID || '|' || PARAM_FILE || '|' || SESSION_NAME || '|' || PARAM_NAME || '|' || PARAM_VALUE || '|' || TYPE || '\n' INTO :param_data
FROM CTL_INFA_PARAM
WHERE INTERFACE_ID='$INTRFC_ID' AND PARAM_FILE='$param_f';

EXIT;
EOF`

# write the parameter data in the temp parameter file
echo $param_data > $paramfile


The above script will connect to Oracle, select a a srtring and put's it into a file, the problem I'm facing is that some rows "strings" will have spaces "see red" in the output below, I noticed that this will happen only if the number of characters exceeds 80

The actual data does not have those spaces
I tried playing with those switches >> FEED OFF HEAD OFF TRIMS ON << but no go.

Please HELP.

11|AZR_ACTVTY_IN.param|s_COST_CENTER_DIM|DBConnectionODS|ODS_CAD|VAR
11|AZR_ACTVTY_IN.param|s_CTL_INTERFACE_PGM_EXEC_LOG_CUSTOMER_DIM|DBConnectionODS |ODS_CAD|VAR
11|AZR_ACTVTY_IN.param|s_CTL_INTERFACE_PGM_EXEC_LOG_CUSTOMER_DIM|INTERFACEID|11| PAR
11|AZR_ACTVTY_IN.param|s_CTL_INTERFACE_PGM_EXEC_LOG_FACT_ACTIVITY|DBConnectionOD S|ODS_CAD|VAR
11|AZR_ACTVTY_IN.param|s_CTL_INTERFACE_PGM_EXEC_LOG_FACT_ACTIVITY|INTERFACEID|11 |PAR
  #2 (permalink)  
Old 08-10-2006
tmarikle tmarikle is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2005
Posts: 683
Add SET LINESIZE 1000 to your parameter list. TRIMSPOOL ON will get rid of trailing spaces. Your line is being broken up by the default LINESIZE value.

Code:
{
param_data=`sqlplus -S user/pwd@db << EOF

SET lines 10   ECHO OFF NEWP 0 SPA 0 PAGES 0 FEED OFF HEAD OFF TRIMS ON

VARIABLE param_data VARCHAR2(1000);

WHENEVER SQLERROR EXIT SQL.SQLCODE ROLLBACK;

SELECT 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n'
 INTO :param_data
FROM dual;

EXIT;
EOF`
print $param_data
}
xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx


Code:
{
param_data=`sqlplus -S user/pwd@db << EOF

SET lines 1000   ECHO OFF NEWP 0 SPA 0 PAGES 0 FEED OFF HEAD OFF TRIMS ON

VARIABLE param_data VARCHAR2(1000);

WHENEVER SQLERROR EXIT SQL.SQLCODE ROLLBACK;

SELECT 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n'
 INTO :param_data
FROM dual;

EXIT;
EOF`
print $param_data
}
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


Last edited by tmarikle; 08-10-2006 at 07:31 PM..
  #3 (permalink)  
Old 08-10-2006
Nomaad Nomaad is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 18
Tmarkil-

Thanks so much for the fast reply....!

I should have looked into the news group first, the answer was there
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 08:29 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