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
Spliting file based on condition Raamc Shell Programming and Scripting 2 05-15-2008 12:51 PM
Help on Spliting files - urgent rajee Shell Programming and Scripting 8 03-10-2008 01:01 PM
Spliting the line based on position. senthil_is Shell Programming and Scripting 1 09-26-2007 02:32 AM
spliting up a huge file grinder182533 UNIX for Dummies Questions & Answers 2 11-10-2006 09:43 AM
spliting up sentences stevox UNIX for Dummies Questions & Answers 2 04-17-2001 04:36 AM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 03-31-2006
harsh_kats harsh_kats is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 2
Exclamation spliting variable value

Hi,

I am reading two values from oracle to unix variable and spliting them using the read command as follows,

get_details=`sqlplus -s $sld_user/$sld_password@$sld_string<<EOF

whenever sqlerror exit 1
whenever oserror exit 1

set feedback off
set heading off
set pagesize 0
set echo off
set verify off

select one_value||'-'||second_value
from test_table
where processed_flag = 'N'
and error_flag = 'N'
and rownum < 2;

exit
EOF`

echo $get_details

IFS=-
read get_upload_id get_sold_to<<X
$get_details
X
echo $one_value
echo $second_value

Now this script is woking but when i try it another way as bellow,

get_details=`sqlplus -s $sld_user/$sld_password@$sld_string<<EOF

whenever sqlerror exit 1
whenever oserror exit 1

set feedback off
set heading off
set pagesize 0
set echo off
set verify off

select upload_id||'-'||sold_to_distr_code
from st_file_load_splitter
where processed_flag = 'N'
and error_flag = 'N'
and rownum < 2;

exit
EOF`
echo $get_details

if [ -z "$get_details" ];
then
echo ' No rows selected from database'
exit
else
echo 'now spliting the string'
IFS=-
read one_value second_value<<X
$get_details
X
echo $one_value
echo $second_value
fi

then i am getting the error saying

" syntax error at line XX: 'end of file' unexpected "

can any one please help me what is wrong with the second script.
 

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 06:43 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