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.
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.