Hi there,
I am just wondering if somebody can help me find out why am I getting additional characters on my "echo" command to create a text file. Here's my unix script :
#!/bin/ksh
#============================================================
# Script Name : chk_ORDHD.ksh
# Description : This script checks for XORD* files with
# incorrect HD count value
#============================================================
. /glo71sw/pro4bin/crondevl716
DIRSCRIPT=$PRODATA/scripts
cd $PRODATA
XORDDOWNLD=`ls XORD????.DLD`
export XORDDOWNLD
echo $XORDDOWNLD >> jgo.log
# clear report files....
> check_ORDHD.incorrect
> check_ORDHD.correct
for i in $XORDDOWNLD
do
# after getting the file, make sure header count is correct.
TOT_CNT=`cat $i | wc -l`
TOT_HD=`cat $i | grep "HD" | cut -c17-25`
# Compare total lines with total count in HD record
if [ $TOT_CNT -eq $TOT_HD ]
then
echo "$i has correct count : $TOT_CNT" >> check_ORDHD.correct
else
echo "$i has incorrect count : HD = $TOT_HD, Record = $TOT_CNT" >> check_O
RDHD.incorrect
fi
done
if [ -s check_ORDHD.incorrect ]
then
cat check_ORDHD.incorrect | elm -s"ORD Files with incorrect HD"
test@test.com
fi
And then when I run this, I get the following email output. I am not sure where the extra "U" and "B" are coming from :
XORD0001.DLD has incorrect count : HD = 000000005, Record = 61
XORD0002.DLD has incorrect count : HD = 000000040, Record = 43
XORD0003.DLD has incorrect count : HD = 000000028
U
U
B, Record = 139
XORD0004.DLD has incorrect count : HD = 000000100
U
U
B, Record = 213
XORD0005.DLD has incorrect count : HD = 000000033
U
U, Record = 108
XORD0007.DLD has incorrect count : HD = 000000008, Record = 57
Thanks!
Joseph