Please help!!!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Please help!!!
# 22  
Old 07-20-2006
Reborg,

How can I change the shell to bask. Is it not advisable to keep the script in ksh and run?

Kindly suggest.
# 23  
Old 07-20-2006
Are you running currently this in a script or from the command line?
# 24  
Old 07-20-2006
Reborg,

I am running this from command line presently.
# 25  
Old 07-20-2006
ok, just type bash to switch to bash, and run the command. That should allow you to confirm that the syntax does what you want.
# 26  
Old 07-20-2006
Reborg,

I think bash is not installed on my server. It says

sh: bash: not found

So I think the only option is script right!!! But even the script may not work as it can't accept that many lines in a single line. Kindly suggest.
# 27  
Old 07-20-2006
Reborg,

I have copied this entirely into a script file and tried to execute it. But I am getting this error I got before.

I copied correctly into the .ksh file

The error as follows:

Below is the script file and error below: i don't know where I am going wrong.




awk '{data[FNR] = $0; out=CARE01_DLY_???_date+%Y%m%d"_new";
file[FNR]=out;} END { if ( FNR - 2 == $1) { for ( i=2 ; i < FNR; i++ ) {
print data > file[i]} close(file[i])}else { print "error"} }'
CARE01_DLY_???_date+%Y%m%d


syntax error The source line is 1.
The error context is
{data[FNR] = $0; >>> out=CARE01_DLY_?? <<<
awk: The statement cannot be correctly parsed.
The source line is 1.

Please suggest.
# 28  
Old 07-20-2006
Code:
awk '{data[FNR] = $0; out=FILENAME "_new"; file[FNR]=out;} END { if ( FNR - 2 == $1) { for ( i=2 ; i < FNR; i++ ) { print data[i]  > file[i]}  close(file[i])}else { print "error"} }' CARE01_DLY_???_`date+%Y%m%d`

I'll try this again...this is the code, do not change ANYTHING, just copy and paste it, exactly as it is, into your script, do not edit any of the code.
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question