troubleshooting Question

Unix Script to load SQLLOADER

Avatar of hobbssh49
hobbssh49 asked on
Unix OS
2 Comments1 Solution1465 ViewsLast Modified:
I have a unix script to read flat files that are being SQLLOADER into oracle table.  My question is how can I get the unix script to read all the files in directory one at time.  If there are more than one file in the directory I get an error, so copy the files to another directory and copy one over at time to load all the files.  Below is the UNIX script.  any help I greatly appreciated

. $HOME/.kshrc
# following sets up environment using relative paths
        cd `dirname $0`
        OURCURENV=`pwd|cut -f3 -d/`
        . /slsmart/$OURCURENV/common/bin/
# end of following sets up environment using relative paths
export infile=$EDIHOME
export bad=$MARTHOME/bad
export dcs=$MARTHOME/decard

cd $MARTHOME/edi/indata

  mv *  867IN.dat
  for X in $(ls $MARTHOME/edi/indata/*.dat|sort);do
  cd $MARTHOME/edi/ctl
  echo " " >> $LOGFILE
  echo " Loading EDI data file"
  sqlldr $LOGIN/$PASSWD@$SERVER edi_data.ctl log=edi_data.log Bad=edi_data.bad s
kip=1 rows=100 discard=edi_data.dis silent=header
  mv edi_data.log $MARTHOME/log
  cd $MARTHOME/indata
  rm -f  *867IN.dat
  compress 867IN.dat
  mv *.Z $MARTHOME/logs

#. /slsmart/common/bin/
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
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 1 Answer and 2 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