BCP with cat not working


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers BCP with cat not working
# 1  
Old 06-30-2015
BCP with cat not working

Hello,

I am facing a typical problem in my code . If I run bcp alone it is working fine if I run BCP with cat it is not working . Not able to find where the error is occurring in cat . Can you please help

Code:
bcp ${_DBName}..logfile in ${_currdate} -f$PANEL_HOME/format/logfile.fmt -Q -U$_UserId -P$_Password

--- Working

Code:
 cat <<-endOfCat | bcp ${_DBName}..logfile in ${_currdate} -Q -U$_UserId -P$_Password -f$PANEL_HOME/format/logfile.fmt
 endOfCat

-- Not working Error below


Code:
job_process_logfile: line 338: syntax error at line 343: `<<' unmatched

THanks,
Arun

Last edited by rbatte1; 06-30-2015 at 07:43 AM.. Reason: Set CODE tags for error message
# 2  
Old 06-30-2015
What are you trying to achieve here? I don't understand because you haven't told us the overall objective.

Excluding the (probably useless) cat, the two commands are different. Can you run the statement without the cat wrapping?





Regards,
Robin

Last edited by rbatte1; 06-30-2015 at 07:45 AM.. Reason: noticed there is a difference in the two commands
# 3  
Old 06-30-2015
I am trying to do BCP, I copied the BCP part from existing code . Nothing changed now wiht my new code the BCP is not working with cat and when I do it individually it is working

Without CAT wrapping it is working fine. Dont why with cat it is not working

Thanks,
Arun
# 4  
Old 06-30-2015
So can you explain the difference?

The first is this:-
Code:
bcp ${_DBName}..logfile in ${_currdate} -f$PANEL_HOME/format/logfile.fmt -Q -U$_UserId -P$_Password

The second (without the cat wrapping) is this:-
Code:
bcp ${_DBName}..logfile in ${_currdate} -Q -U$_UserId -P$_Password -f$PANEL_HOME/format/logfile.fmt

Is the order of flags/parameters important?

Can you tell us what you are trying to achieve by wrapping it with a cat? That might steer us towards a suggestion for you.



Robin
# 5  
Old 06-30-2015
What shell are you using?
What be the result of
Code:
cat <<-endOfCat | cat -vet
a
b
c
endOfCat

?
# 6  
Old 06-30-2015
Hello RudiC,

the output is
Code:
a$
b$
c$

I am using Korn shell.

Hi rbatte1,

Whatever the order I put the error is appearing and it is working when I do without cat . Since this Cat with BCP is used in existing code and working fine I opted this option.

Thanks,
Arun

Last edited by rbatte1; 06-30-2015 at 09:57 AM.. Reason: Added CODE tags
# 7  
Old 06-30-2015
So, what are you trying to achieve by adding the cat? I just don't understand what the goal is. Smilie



Robin
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cat command not working to display Mac file in Ubuntu

Hi, Recently I got a .txt file from Mac user. when I try to open it in my Ubuntu machine using cat command it is not displaying any content of file however I can see the content using vi. Anyone know How to see its content using cat as I have to process it in my shell script. Thanks in... (4 Replies)
Discussion started by: diehard
4 Replies

2. Shell Programming and Scripting

bcp error

hi all, Getting error while working on sybase::bcp as below, DB-Library error: Attempt to convert data stopped by syntax error in source field. Code is like, my $bcp_files = new Sybase::BCP $usr, $pass, $server; ---------- Post updated at 02:05 AM ---------- Previous update... (0 Replies)
Discussion started by: Deei
0 Replies

3. Shell Programming and Scripting

bcp command help

Hi, When i execute a script in unix, the result i got is :: ./purgeErrors.ksh: bcp: not found What is the meaning of that output ? --- Aditya (9 Replies)
Discussion started by: chaditya
9 Replies

4. Shell Programming and Scripting

sybase::bcp

I am trying to bcp in using sybase::bcp perl module. I can find we can give user, pwd and server name in the parameters. How can I give database and table name? (1 Reply)
Discussion started by: Deei
1 Replies

5. Shell Programming and Scripting

BCP command or module

Hi All, I am trying to bcp in data file into database. now there is bcp command available in unix and another perl module Sybase::BCP is also available. Can anyone please let me know if there is any limitations of bcp command in unix. whichever is good to use? (1 Reply)
Discussion started by: Deei
1 Replies

6. OS X (Apple)

Cat command not working as expected

I've been trying to figure this out since last night, and I'm just stumped. The last time I did any shell scripting was 8 years ago on a Unix box, and it was never my strong suit. I'm on a Mac running Leopard now. Here's my dilemma - hopefully someone can point me in the right direction. I'm... (10 Replies)
Discussion started by: Daniel M. Clark
10 Replies

7. Shell Programming and Scripting

cat in the command line doesn't match cat in the script

Hello, So I sorted my file as I was supposed to: sort -n -r -k 2 -k 1 file1 | uniq > file2 and when I wrote > cat file2 in the command line, I got what I was expecting, but in the script itself ... sort -n -r -k 2 -k 1 averages | uniq > temp cat file2 It wrote a whole... (21 Replies)
Discussion started by: shira
21 Replies

8. UNIX for Advanced & Expert Users

cat and grep not working

I am trying to cat a file and then grep that file for a number. I can do it fine on other files but this particular file will not do anything. I tried running it on an older file from the same device but it is just not working. The file is nothing more than a flat file on a unix box. Here is just a... (3 Replies)
Discussion started by: jphess
3 Replies

9. UNIX for Dummies Questions & Answers

Difference between cat , cat > , cat >> and touch !!!

Hi Can anybody tell the difference between Difference between cat , cat > , cat >> and touch command in UNIX? Thanks (6 Replies)
Discussion started by: skyineyes
6 Replies
Login or Register to Ask a Question