Hi, I get a "FILEPATH: not found" error on the 3rd line and the line where it is within the case. Any idea as to why I'm getting this error time and time again?
Oh and FILEPATH will store the directory of the file.
I appreciate any help!
IAM=`basename $0`
RC=0
FILEPATH = ""
##################################################################
# Setup the common variables and give access to common functions #
##################################################################
if [[ $COMMON_HOME != "" ]]
then
. $COMMON_HOME/scripts/PACE_common.ksh
RC=$?
else
echo "COMMON_HOME environmental not set--`/usr/bin/basename $0` ending run."
echo "Processing discontinued."
RC=$PACE_UNAVAIL
exit $RC
fi
##############################################################
# Collect the allow parameters and trap the unknowned #
##############################################################
while getopts :s:h opt;
do
case $opt in
s) FILEPATH = "$OPTARG";;
h) log_data $IAM "Displaying usage screen."
display_usage
exit 0;;
*) RC=$UNK_PARM
log_data $IAM "E-$RC" "Invalid parameter received.";;
esac
done
#########################################################################
#Processsing of the -s parameter #
#########################################################################
if [[ ! -e $FILEPATH ]]
then
RC=$FILE_NOTFOUND
log_data $IAM "Input file not found"
exit $RC
if [[ $FILEPATH != "*.txt*" ]]
then
RC=$INVALID_FILE
log_data $IAM "Invalid file received."
exit $RC
fi
awk '{printf $0; for (i=1;i<=19;i++) printf $3; print "\n"}' $FILEPATH > inputfile.txt
awk -v OFS="," '{gsub("-", " -"); print $1,$2,$3+0,$4+0}' OFMT='%.2f' $FILEPATH > tempinputfile.txt
awk '{printf $0 " "; for (i=1;i<=38;i++) printf $4 " "; print "\n"}' tempinputfile.txt > inputfile.csv
rm -f tempinputfile.txt
function display_usage
{
echo ""
echo "Usage is:"
echo "expandInputFile.ksh -s <source path> "
echo ""
echo "Parameter requirements:"
echo "-s <source path>: This is a required parameter that will accept the"
echo " given path of the input file. It must be in .txt"
echo " format"
}