spliting variable value


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting spliting variable value
# 1  
Old 03-31-2006
Error 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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

XML spliting

hi, Am able to split an XML file by using follwing awk command, awk 'NR==1{x=$0;next}/<\/Order>/{print y RS $0 RS "</Order>">f}/Order BillToKey/{f="file"++n".xml";y=x}{y=y RS $0}' filename.xml but i need to insert a following tag in the begining of every file how to do so. The tag is as... (7 Replies)
Discussion started by: mitnix
7 Replies

2. UNIX for Dummies Questions & Answers

Spliting of two files

hi I have a log file which contains some reports. The log file looks like this:- STARTOFREPORT /tmp file1.txt some text to be folowd ENDOFREPORT some non utilized characters STARTOFREPORT /log file2.txt more text (3 Replies)
Discussion started by: infyanurag
3 Replies

3. Shell Programming and Scripting

spliting up a large file

Dear All, I have a very large file which which i would like split into indvidual frames evrytime the line ends with "ENDMDL" and then name frame1.pdb frame2.pdb etc can any one give me a few sugeestions? ideally i would like to have ENDMDL at the end of each frame or not pressent at all. an... (4 Replies)
Discussion started by: Mish_99
4 Replies

4. Shell Programming and Scripting

File Spliting problem

I have a very big log file which looks like this: I need to split this file and create files with "+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+" as the delimiter. The file names need to be the contents of the next line after the delimiter(FIRST_ITEM,SECOND_ITEM...so on..). (7 Replies)
Discussion started by: engineer
7 Replies

5. UNIX for Dummies Questions & Answers

spliting a file

how would i split the file "file1" into smaller files containg lines of 15 (1 Reply)
Discussion started by: JamieMurry
1 Replies

6. Shell Programming and Scripting

awk help with string spliting

Hello all, I am having a problem with awk's string split function. I have a string that has a number at the end, I am trying to remove the alpha portion of the string and just have the numeric part. Here is my code and the result: BEGIN { word = "$category121"; split(word, a, 121) print... (2 Replies)
Discussion started by: RobertSubnet
2 Replies

7. Shell Programming and Scripting

Spliting the file dynamically

i am creating the file , when this file reaches the size 2 GB, i need one message or fire (4 Replies)
Discussion started by: kingganesh04
4 Replies

8. Shell Programming and Scripting

spliting 4gb files to 4*1 gb each

I have log file whose size is 4 GB , i would like to split it to 1 gb each ,Can any one tell me the syntax of csplit comand for that. I am using Sun0S 5.8 (3 Replies)
Discussion started by: jambesh
3 Replies

9. Shell Programming and Scripting

Help on Spliting files - urgent

Hi Script Masters I have a strange requirement. Please help. I am using C shell. I have a file like the below in sorted order 22 23 25 34 37 45 67 342 456 476 543 677 789 Now I have to split the file in such a way that first 5 of 2 digit number should be saved as aaa.in and the... (8 Replies)
Discussion started by: rajee
8 Replies

10. UNIX for Dummies Questions & Answers

spliting up sentences

hello, i'm looking to split up text into a list of words but can't figure it out, any help would be great. thanks steven (2 Replies)
Discussion started by: stevox
2 Replies
Login or Register to Ask a Question