troubleshooting Question

shell error(UNIX)

Avatar of sam shah
sam shah asked on
Shell Scripting
5 Comments2 Solutions131 ViewsLast Modified:
#!/bin/ksh


# set umask to allow output files to be overwritten by other users

umask 000

export INBOUND_DIR=/home/ABC/IN
export ARCHIVE_DIR=/home/ABC/Archive
export LOG_DIR=/home/ABC/log
export SCRIPT_DIR=/proc/bin
date_str=$(date "+%Y%m%d%H%M%S")
cd $INBOUND_DIR
find . -type f -name "* *.csv" | while read f; do mv "$f" "$(echo "$f"|sed 's/ /_/g')";done
ls -ltr | grep -v ^d | awk '{print $9}' | while read f; do
VAR1=`echo $f`
$ORACLE_HOME/bin/sqlplus -s $MMUSER/$PASSWORD <<EOF
insert into ls_file_process_ind values('$VAR1','N',sysdate,sysdate);
delete ls_file_process_ind where FILE_NAME is NULL;
commit;
if [ -f ABC_*.csv ]
then
for data_file in $(ls -rt ABC_*.csv 2>/dev/null) ;
do
  DATA_FILE="$INBOUND_DIR/$data_file"
  BAD_FILE="$LOG_DIR/$data_file.bad"
  PAR_FILE="$INBOUND_DIR/lm_con_tsf_par.par"
  FILE_NAME="$data_file"
  LOG_FILE="$LOG_DIR/$data_file.log"

  cd $SCRIPT_DIR
  #----------------------------------------------------------------------------
  #  Load Record information.
  #----------------------------------------------------------------------------
  sqlldr $UP data=$DATA_FILE control=ls_con_tsf_ctl.ctl bad=$BAD_FILE log=$LOG_FILE errors=9999 > /dev/null

  retcode=`echo $?`
  case "$retcode" in
  0) echo "SQL*Loader execution successful" ;;
  1) echo "SQL*Loader execution exited with EX_FAIL, see logfile" ;;
  2) echo "SQL*Loader execution encountered a fatal error" ;;
  *) echo "unknown return code";;
  esac
  #----------------------------------------------------------------------------
  #  Move download data file to backup directory.
  #----------------------------------------------------------------------------
  cd $INBOUND_DIR
  mv $FILE_NAME $ARCHIVE_DIR/$FILE_NAME
 ls -ltr | grep -v ^d | awk '{print $9}' | while read f; do
 VAR1=`echo $f`
 $ORACLE_HOME/bin/sqlplus -s $MMUSER/$PASSWORD <<EOF
 update ls_file_process_ind set PROCESS_IND='Y',last_update_datetime=sysdate where FILE_NAME='$VAR1';
 commit;
 done
 else
 echo "NO files found or file name is in wrong format"
 fi


ERROR:  0403-057 Syntax error at line 28 : `<' is not matched.

Please help

Thanks in advance
ASKER CERTIFIED SOLUTION
simon3270

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros