warning: here-document delimited by end-of-file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting warning: here-document delimited by end-of-file
# 1  
Old 07-27-2012
warning: here-document delimited by end-of-file

Hi ,

My chunk of code is as follows:

Code:
create_db(){
isql -Usa -Paaa123 -S$DB_SERVER <<- BOF
 sp_addlogin $Conf, aaa123
 go
 sp_addlogin mb, aaa123
 go
 create database $Conf on $DATA_DEVICE=800 log on $LOG_DEVICE=200
 go
 online database $Conf
 BOF
isql -U$2 -Paaa123 -S$DB_SERVER -D$2 -i abc/path/etc/abc.sql
}

I keep getting the below error message

Code:
./testamb.sh: line 121: warning: here-document at line 54 delimited by end-of-file (wanted `BOF')
./testamb.sh: line 122: syntax error: unexpected end of file


Last edited by Scott; 07-27-2012 at 03:07 AM.. Reason: Code tags
# 2  
Old 07-27-2012
Most likely, the line with BOF contains another "invisible" character. Perhaps there's a trailing space or tab character. Maybe it's a carriage return inserted by a Windows text editor or ftp transfer.

sed -n l file should reveal what's there (or od, hd, hexdump, vis).

Regards,
Alister
# 3  
Old 07-27-2012
Remove indentation from the closing "BOF". No-one saw that because you didn't use code tags!
These 2 Users Gave Thanks to Scott For This Post:
# 4  
Old 07-27-2012
Thanks Scott the indentation was indeed the problem.But when I run this chunk of code nothing actually happens it executes but no action is performed..I was hoping that the script would logon to a Sybase server and create a database.
# 5  
Old 07-27-2012
Your code is in a function (create_db). Did you execute that in your script?
# 6  
Old 07-27-2012
Well ofcourse I did..

Code:
#!/bin/sh

create_db(){
isql -Usa -Paaa123 -S$DB_SERVER <<- BOF
 sp_addlogin $Conf, aaa123
 go
 sp_addlogin mb, aaa123
 go
 create database $Conf on $DATA_DEVICE=800 log on $LOG_DEVICE=200
 go
 online database $Conf
BOF
isql -U$2 -Paaa123 -S$DB_SERVER -D$2 -i abc/path/etc/abc.sql
}
create_db


Last edited by Scott; 07-27-2012 at 03:35 AM.. Reason: Code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Need to convert a pipe delimited text file to tab delimited

Hi, I have a rquirement in unix as below . I have a text file with me seperated by | symbol and i need to generate a excel file through unix commands/script so that each value will go to each column. ex: Input Text file: 1|A|apple 2|B|bottle excel file to be generated as output as... (9 Replies)
Discussion started by: raja kakitapall
9 Replies

2. Shell Programming and Scripting

Warning while sorting : A newline character was added to the end of file

Hi, I am trying to sort a csv file which has say 10 lines each line having a row size that is upto 30183 no. of COLUMNS (Row length = 30183). There is a LINE FEED (LF) at the end of each line. When I try to sort this file say, based on the second FIELD using the below command, sort -t ',' +1... (5 Replies)
Discussion started by: DHeisenberg
5 Replies

3. Shell Programming and Scripting

How to make tab delimited file to space delimited?

Hi How to make tab delimited file to space delimited? in put file: ABC kgy jkh ghj ash kjl o/p file: ABC kgy jkh ghj ash kjl Use code tags, thanks. (1 Reply)
Discussion started by: jagdishrout
1 Replies

4. UNIX for Dummies Questions & Answers

Removing empty lines at the end of a Tab-delimited file

I'm trying to remove all of the empty lines at the end of a Tab delimited file. They have no data just tabs. I've tried may things, here are a couple: sed /^\t.\t/d File1 > File2 sed /^\t{44}/d File1 > File2 What am I missing? (9 Replies)
Discussion started by: SirHenry1
9 Replies

5. Shell Programming and Scripting

Help with converting Pipe delimited file to Tab Delimited

I have a file which was pipe delimited, I need to make it tab delimited. I tried with sed but no use cat file | sed 's/|//t/g' The above command substituted "/t" not tab in the place of pipe. Sample file: abc|123|2012-01-30|2012-04-28|xyz have to convert to: abc 123... (6 Replies)
Discussion started by: karumudi7
6 Replies

6. Shell Programming and Scripting

How to convert a space delimited file into a pipe delimited file using shellscript?

Hi All, I have space delimited file similar to the one as shown below.. I need to convert it as a pipe delimited, the values inside the pipe delimited file should be as highlighted... AA ATIU2345098809 009697 005374 BB ATIU2345097809 005445 006518 CC ATIU9685098809 003215 003571 DD... (7 Replies)
Discussion started by: nithins007
7 Replies

7. Shell Programming and Scripting

Append text from one file to another based on a search from the end of a document

Hi all, I have output files that are all text files with various different extensions. So, if I submit the input file "job_name.inp", when it finishes I get an output file "job_name.dat". A typical input file looks something like this: $CONTRL SCFTYP=RHF RUNTYP=ENERGY MAXIT=199 MULT=1... (4 Replies)
Discussion started by: marcozd
4 Replies

8. Shell Programming and Scripting

convert a pipe delimited file to a':" delimited file

i have a file whose data is like this:: osr_pe_assign|-120|wg000d@att.com|4| osr_evt|-21|wg000d@att.com|4| pe_avail|-21|wg000d@att.com|4| osr_svt|-11|wg000d@att.com|4| pe_mop|-13|wg000d@att.com|4| instar_ready|-35|wg000d@att.com|4| nsdnet_ready|-90|wg000d@att.com|4|... (6 Replies)
Discussion started by: priyanka3006
6 Replies

9. UNIX for Dummies Questions & Answers

Converting Space delimited file to Tab delimited file

Hi all, I have a file with single white space delimited values, I want to convert them to a tab delimited file. I tried sed, tr ... but nothing is working. Thanks, Rajeevan D (16 Replies)
Discussion started by: jeevs81
16 Replies

10. Shell Programming and Scripting

Converting Tab delimited file to Comma delimited file in Unix

Hi, Can anyone let me know on how to convert a Tab delimited file to Comma delimited file in Unix Thanks!! (22 Replies)
Discussion started by: charan81
22 Replies
Login or Register to Ask a Question