![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 | |||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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 |
|
||||
|
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.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|